mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Criteria Matching Ignoring In Memory Changes #5231
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 @awhitby on GitHub (Aug 25, 2016).
This seems to be the same issue reported in https://github.com/doctrine/doctrine2/issues/3046, however
It appears that if I make a change to an entities field without flushing, the subsequent matching call with a criteria queries the database for the association and returns incorrect results. The in memory changes are still applied though
Given this function:
Running the following will output "true true"
Marking one of those users as inactive and running the same criteria match will output "false true"
This bug is forcing me to perform a flush before every criteria query which is extremely draining on performance. If anyone can shed some light on this it would be appreciated
@akomm commented on GitHub (Jun 19, 2017):
Same issue in onFlush. Only here I can not flush, so I have to do something like $entity->collection->toArray() to force a fetch & merge. A better workaround is appreciated.
@lcobucci commented on GitHub (Jun 23, 2017):
@awhitby could you please send us a PR with a functional test that reproduces this behaviour? Sending just an example doesn't give us the complete overview of things and why it fails. You can find examples on
971c400025/tests/Doctrine/Tests/ORM/Functional@dmontero commented on GitHub (Nov 17, 2017):
Same problem here. I'm trying to run a criteria::matching after persist but it doesn't see the new elements being persisted.
If I flush, then it works