DQL JOIN FETCH or fetch=EAGER mapping for a collection-heavy entity that is sometimes only counted
Scenario An application built on Doctrine ORM has an entity with a large one-to-many collection. Some code paths iterate the full collection, while others only need its size. The default lazy loading triggers one extra query per access, and in detached states it risks a LazyInitializationException, so a more deliberate fetching strategy is needed. The trade-