mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-3843: indexBy collection loses index key after calling a ->matching(criteria) on it #4709
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 (Jul 22, 2015).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user bitonda:
When I retrieve a filtered collection of entities which has indexBy attribute it loses index keys in the result. Before calling matching() method i tried to call toArray() and It solved the problem, I don't know if it is a bug .
@vlastv commented on GitHub (Dec 8, 2015):
+1
@Ocramius commented on GitHub (Dec 9, 2015):
Related: #5539
@ureimers commented on GitHub (Mar 15, 2016):
Also having the same issue.
Calling
toArray()solves the problem because the collection becomes initialized (loaded entirely from the DB). If a collection is initialized,matching()doesn't trigger a DB-Query but acts directly on the already loaded collection.But calling
toArray()as a workaround before callingmatching()effectively kills the benefit of usingmatching()in the first place.@chmielot commented on GitHub (Apr 15, 2016):
+1
@maresja1 commented on GitHub (May 20, 2016):
+1
@ericnilo commented on GitHub (Jun 1, 2016):
+1
@internalsystemerror commented on GitHub (Feb 22, 2017):
+1
@janwebdev commented on GitHub (Apr 3, 2017):
+1
@pavliktomas commented on GitHub (Jan 18, 2018):
+1
@pesu commented on GitHub (Jun 23, 2018):
+1
@beberlei commented on GitHub (Feb 16, 2020):
The problem here is that the line in
PersistentCollection#matchingmust be changed to iterate over the results and build the indexed by map afterwards if indexBy isset:@rela589n commented on GitHub (May 29, 2024):
Hi @greg0ire , if you have some free time, could you look at this?
@greg0ire commented on GitHub (May 29, 2024):
I have other priorities, sorry.