Tag

Doctrine

3 posts tagged Doctrine.

Posts

  • Diagram: a loop firing fifty queries at a database, compared against the same loop firing one query after addSelect().

    09/02/2026

    The N+1 you wrote in a Twig loop, and its fix

    The query looks fine and the template looks fine. Together they issue one query per row, because a lazy association is loaded the moment a template touches it - and templates touch things the controller never did.

  • Doctrine Arbitrary Table Joins on Unassociated Entities

    01/25/2016

    Doctrine: joining entities with no association

    In Symfony using Doctrine, if no association is available for two entities, you can still join them and treat them like they have a relationship. To do so, you have to use the “Join: WITH” method.

  • Diagram: Doctrine's flush() taking two paths, a silent commit or a thrown exception that has to be caught by type.

    11/19/2013

    Knowing whether a Doctrine insert or update worked

    Doctrine has no return value to check after flush() - it signals failure by throwing. Wrapping it is the right instinct, but the version of this snippet that has been circulating since 2013 catches nothing at all.

Often tagged together with