PersistentCollection::count() method consumes too much memory and time when there are many referenced documents. It queries and hydrates referenced documents and uses ArrayCollection::count() method to get quantity of result elements instead of executing count command into database.
This PR improves PersistentCollection::count() method. New behavior:
fixed DocumentPersister::loadReferenceManyWithRepositoryMethod() with…
… hint slave okay
PersistentCollection::count() with ReferenceMany InverseSide mapping …
…queries DB without collection initialization
Cool. Looks like a nice change! 👍
Thanks for the PR. I'm going to hold off on including this in BETA9 because there will be some collection refactoring coming up and I'd like to integrate this with those changes.
In the meantime, there is a gh543 branch with this PR rebased atop master (there were some small conflicts), if anyone would like to grab the change for personal use.