Skip to content

Commit dc4af2a

Browse files
committed
Fix: Correct function reference in code example from slice to sliceToPage
1 parent 996584e commit dc4af2a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/lets-build-an-add-on.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ You may have spotted earlier in the demo_portal_view template that each post we
10511051
'attachments': $post.attach_count ? $post.Attachments : [],
10521052
```
10531053

1054-
Right now, this is going to generate an additional query for each post. So, we should instead try to do a single query for all of the posts we are displaying and add them to the posts in advance. It probably sounds more complicated than it is. Just add the below code beneath the `->slice(0, $perPage, true);` line.
1054+
Right now, this is going to generate an additional query for each post. So, we should instead try to do a single query for all of the posts we are displaying and add them to the posts in advance. It probably sounds more complicated than it is. Just add the below code beneath the `->sliceToPage($page, $perPage);` line.
10551055

10561056
```php title="src/addons/Demo/Portal/Pub/Controller/Portal.php"
10571057
use XF\Repository\AttachmentRepository;

0 commit comments

Comments
 (0)