DDC-2340: Using Criteria matching on non-initialized collections ignore changes made on loaded entities #2941

Closed
opened 2026-01-22 14:08:03 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 7, 2013).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user mnapoli:

Given:

  • you have a non initialized collection (association between entities)
  • you have loaded some entities that are in that collection and changed some fields (without flushing)

If you do a matching using a Criteria on the collection (http://docs.doctrine-project.org/en/latest/reference/working-with-associations.html#filtering-collections), then the Criteria will be executed through a DB query. But the fields you changed are not updated in the DB, so if you filter/order on those fields, then the result of the filter() will be incorrect.

However, if your collection was initialized, the Criteria matching will be done in memory on the ArrayCollection and the result will be correct.

So we have the problem for Criteria filtering on non-initialized collections.

Originally created by @doctrinebot on GitHub (Mar 7, 2013). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user mnapoli: Given: - you have a non initialized collection (association between entities) - you have loaded some entities that are in that collection and changed some fields (without flushing) If you do a matching using a Criteria on the collection (http://docs.doctrine-project.org/en/latest/reference/working-with-associations.html#filtering-collections), then the Criteria will be executed through a DB query. But the fields you changed are not updated in the DB, so if you filter/order on those fields, then the result of the filter() will be incorrect. However, if your collection was initialized, the Criteria matching will be done in memory on the ArrayCollection and the result will be correct. So we have the problem for Criteria filtering on non-initialized collections.
admin added the Bug label 2026-01-22 14:08:03 +01:00
admin closed this issue 2026-01-22 14:08:03 +01:00
Author
Owner

@doctrinebot commented on GitHub (Mar 12, 2013):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Mar 12, 2013): Issue was closed with resolution "Fixed"
Author
Owner

@doctrinebot commented on GitHub (Mar 12, 2013):

Comment created by @beberlei:

Fixed and merged for 2.3.3

@doctrinebot commented on GitHub (Mar 12, 2013): Comment created by @beberlei: Fixed and merged for 2.3.3
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2941