-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[XML] Fix default value of one-to-many order-by to ASC #7146
[XML] Fix default value of one-to-many order-by to ASC #7146
Conversation
$orderBy[(string) $orderByField['name']] = (string) $orderByField['direction']; | ||
$orderBy[(string) $orderByField['name']] = isset($orderByField['direction']) | ||
? (string) $orderByField['direction'] | ||
: 'ASC' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Criteria::ASC
if possible
@@ -9,7 +9,7 @@ | |||
<one-to-many field="attractions" target-entity="Doctrine\Tests\Models\Cache\Attraction" mapped-by="city"> | |||
<cache usage="READ_ONLY" /> | |||
<order-by> | |||
<order-by-field name="name" direction="ASC"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do define new mapping files for tests, and leave the existing ones be
@@ -68,7 +68,7 @@ | |||
<cascade-persist/> | |||
</cascade> | |||
<order-by> | |||
<order-by-field name="number" direction="ASC" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert: use your own mapping file/scenario here please
@@ -49,7 +49,7 @@ | |||
<cascade-merge/> | |||
</cascade> | |||
<order-by> | |||
<order-by-field name="number" direction="ASC" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert: use your own mapping file/scenario here please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test additions are still needed here
45b8089
to
762a9ac
Compare
762a9ac
to
2560d4f
Compare
@Ocramius I've added a test, this was what you expect ? |
@Awkan yep, this matches, thanks 👍 |
Problem
As mentioned in issue #7141 , when we use XML mapping for a
<one-to-many>
relation with an<order-by>
node, the default valuedirection=ASC
isn't set by default.Solution
In this PR, I define the default direction to
ASC
if not set