mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #1033] [CLOSED] Lazy criteria for ManyToMany collection #9069
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?
📋 Pull Request Information
Original PR: https://github.com/doctrine/orm/pull/1033
Author: @bakura10
Created: 5/18/2014
Status: ❌ Closed
Base:
old-prototype-3.x← Head:many-to-many-lazy📝 Commits (1)
46816aeInitial support📊 Changes
10 files changed (+231 additions, -19 deletions)
View changed files
📝
lib/Doctrine/ORM/Cache/Persister/AbstractCollectionPersister.php(+9 -2)➕
lib/Doctrine/ORM/LazyManyToManyCriteriaCollection.php(+109 -0)📝
lib/Doctrine/ORM/PersistentCollection.php(+4 -2)📝
lib/Doctrine/ORM/Persisters/AbstractCollectionPersister.php(+28 -1)📝
lib/Doctrine/ORM/Persisters/CollectionPersister.php(+3 -2)📝
lib/Doctrine/ORM/Persisters/ManyToManyPersister.php(+12 -3)📝
lib/Doctrine/ORM/Persisters/OneToManyPersister.php(+7 -3)📝
tests/Doctrine/Tests/Models/Quote/User.php(+3 -2)📝
tests/Doctrine/Tests/ORM/Functional/PersistentCollectionCriteriaTest.php(+48 -4)📝
tests/Doctrine/Tests/OrmFunctionalTestCase.php(+8 -0)📄 Description
This continues my previous work on making Criteria most efficient.
Currently we are wrapping matching calls on repositories and matching calls on EXTRA_LAZY associations around a LazyCriteria. However, ManyToMany are still completely loaded: https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/PersistentCollection.php#L874
This is still problematic from a performance point of view because count, contains... cannot be optimized. I think the solution is similar to previous one, hence creating a Lazy collection for that kind of associations.
However, this is really tricky to do because of the whole mess inside the persisters (can't wait for them to be completely refactored, it's getting really hard to maintain this mess :p).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.