Answer the question
In order to leave comments, you need to log in
Does Symfony/Doctrine optimize entity queries?
Please tell me, if you make a request to an entity, for example, "the number of records with ID = 5" through the entityManager / createQueryBuilder and then re-execute such a request several times, does it optimize Doctrine? What are the ways to "correctly" optimize this behavior so that there is only one request?
Answer the question
In order to leave comments, you need to log in
in the sense of whether it magically caches? no. The only caveat - if you do this on a collection and all the data from the collection is already loaded into memory - then yes, it will simply count the number of objects that match the criterion (matching method for filtering collections). And so ... only selections by the primary key if the entity is already loaded.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question