G
G
grabbee2016-03-16 01:48:48
symfony
grabbee, 2016-03-16 01:48:48

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

1 answer(s)
S
Sergey, 2016-03-16
@grabbee

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 question

Ask a Question

731 491 924 answers to any question