mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-3322: [GH-1146] Allow orderBy to reference associations #4107
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 (Sep 23, 2014).
Originally assigned to: @guilhermeblanco on GitHub.
Jira issue originally created by user @doctrinebot:
This issue is created automatically through a Github pull request on behalf of c960657:
Url: https://github.com/doctrine/doctrine2/pull/1146
Message:
If I specify an order-by clause on a to-many association, e.g.
@OrderBy({"foo" = "ASC"}), where foo is a to-one-association on the target entity, the collection is sorted by foo_id (this behaviour is implemented in BasicEntityPersister::getOrderBySQL()).This works fine. However, Doctrine\ORM\Tools\SchemaValidator complains that foo is not a field.
This change makes the validator accept order-by clauses on associations where the target entity is the owning side, and the association is single-valued (AFAICT this is the same restrictions that BasicEntityPersister uses).