Bug
The homepage latestPages block has a "max items" config (limit). When a category contains enough pages, the block still renders fewer pages than the configured limit.
Root cause
PageRepository::findPublishedByCategory() (src/Repository/PageRepository.php:64-83) combines:
leftJoin('p.translations', 't')
addSelect('t')
setMaxResults($limit)
This is the classic Doctrine pitfall: setMaxResults applies LIMIT to SQL rows, not hydrated entities. With 2 translations per page (en + fr), limit=5 produces SQL LIMIT 5 → ~2–3 pages after hydration.
Fix
Use Doctrine\ORM\Tools\Pagination\Paginator (which rewrites the query so LIMIT applies to root entities), or do a two-step query: first fetch IDs with LIMIT, then hydrate entities + translations by IDs.
Files
src/Repository/PageRepository.php:64-83 — findPublishedByCategory()
src/Service/HomepageRenderer.php:185-215 — resolveLatestPages() (caller)
Verification
- Create a category with ≥ 10 published pages, each with
en and fr translations.
- Add a
latestPages block with limit = 5 to the homepage.
- Confirm exactly 5 pages render.
- Add a unit test on
PageRepository::findPublishedByCategory asserting count.
Bug
The homepage
latestPagesblock has a "max items" config (limit). When a category contains enough pages, the block still renders fewer pages than the configured limit.Root cause
PageRepository::findPublishedByCategory()(src/Repository/PageRepository.php:64-83) combines:leftJoin('p.translations', 't')addSelect('t')setMaxResults($limit)This is the classic Doctrine pitfall:
setMaxResultsapplies LIMIT to SQL rows, not hydrated entities. With 2 translations per page (en + fr),limit=5produces SQLLIMIT 5→ ~2–3 pages after hydration.Fix
Use
Doctrine\ORM\Tools\Pagination\Paginator(which rewrites the query so LIMIT applies to root entities), or do a two-step query: first fetch IDs with LIMIT, then hydrate entities + translations by IDs.Files
src/Repository/PageRepository.php:64-83—findPublishedByCategory()src/Service/HomepageRenderer.php:185-215—resolveLatestPages()(caller)Verification
enandfrtranslations.latestPagesblock withlimit = 5to the homepage.PageRepository::findPublishedByCategoryasserting count.