mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
XML one-to-many order-by default direction isn't set #5926
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 @Awkan on GitHub (Mar 20, 2018).
Originally assigned to: @Ocramius on GitHub.
Context
I have a
oneToManyrelation between 2 entities. For example an Article which has many tags.My mapping is declared as XML.
Then, I want to get my tags ordered by name. For that, I have the following mapping in my
Article:Problem
By default, this should sort my name field ASC (as mentionned in XSD file). However I have the exception
Invalid order by orientation specified for Tag#nameWay of solution
For the moment, adding explicitly my direction attribute works fine but the default value isn't very default
I've investigate about it and it's appear that during the mapping reading (https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php#L375), the default direction isn't set. Should be set it by default to this line ?
@Ocramius commented on GitHub (Mar 20, 2018):
@Awkan setting the default direction (if not set) in the driver is likely the correct approach.
@lcobucci commented on GitHub (Nov 20, 2018):
Fixed by https://github.com/doctrine/doctrine2/pull/7146