mirror of
https://github.com/doctrine/orm.git
synced 2026-04-29 17:33:15 +02:00
ArrayCollection::matching() : sorting collection by an Entity field is inconsistent. #5876
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 @theredled on GitHub (Feb 11, 2018).
It is impossible to properly sort a collection by an Entity field, as 2 objects can't be compared.
To make it work, it should compare their IDs, __toString() or other.
Example:
What happens:
In ClosureExpressionVisitor
$aValue = ClosureExpressionVisitor::getObjectFieldValue($a, $name);returning object for an object relation, unequal objects are compared using>, always returning false.