mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-3662: "Improve efficiency of One-To-Many EAGER" still do 2 db request when Criteria::$firstResult set #4496
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Apr 4, 2015).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user fedikw:
In Doctrine 2.5 when I have entity with association One-To-Many and fetch="EAGER", doctrine still do 2 db request , when use Criteria with Criteria::$firstResult and Criteria::$maxResults
-last time I tested on Doctrine 2.5 RC 1, and there this have work perfect: doctrine have use JOIN to load association.-
-I think it get broken between 2.5 rc1 and 2.5-
for load the items I use
@doctrinebot commented on GitHub (Apr 4, 2015):
Comment created by @ocramius:
[~fedikw] could you come up with an example?
This looks like logic that goes through the paginator, if I'm not mistaken...
@doctrinebot commented on GitHub (Apr 5, 2015):
Comment created by fedikw:
Example you have entities: Gallery and Image,
where Gallery have field 'images' that is bidirectional association One-To-Many and fetch="EAGER" with Image,
and you load the galleries using matching($criteria), then:
This code will do 1 db request for load Galleries list + 1 db request for each Gallery item, to load its Images
This code will do 1 db request for load All: Galleries and its Images
I use setFirstResult() and setMaxResults() because I use external pagination not from Doctrine.
After small investigation, I found that it because $this->currentPersisterContext->handlesLimits there
e57be9da5e/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php (L1221)@doctrinebot commented on GitHub (May 13, 2015):
Comment created by fedikw:
seems this issue introduced in that commit
a37fa97be3after I remove
I get 1 DB request, but I not sure which impact it could on other cases :/