[XML] Fix default value of one-to-many order-by to ASC#7146
Merged
mikeSimonson merged 1 commit intodoctrine:2.6from Apr 12, 2018
Merged
[XML] Fix default value of one-to-many order-by to ASC#7146mikeSimonson merged 1 commit intodoctrine:2.6from
mikeSimonson merged 1 commit intodoctrine:2.6from
Conversation
Ocramius
reviewed
Mar 21, 2018
| $orderBy[(string) $orderByField['name']] = (string) $orderByField['direction']; | ||
| $orderBy[(string) $orderByField['name']] = isset($orderByField['direction']) | ||
| ? (string) $orderByField['direction'] | ||
| : 'ASC' |
Ocramius
reviewed
Mar 21, 2018
| <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"/> |
Member
There was a problem hiding this comment.
Please do define new mapping files for tests, and leave the existing ones be
Ocramius
reviewed
Mar 21, 2018
| <cascade-persist/> | ||
| </cascade> | ||
| <order-by> | ||
| <order-by-field name="number" direction="ASC" /> |
Member
There was a problem hiding this comment.
Revert: use your own mapping file/scenario here please
Ocramius
reviewed
Mar 21, 2018
| <cascade-merge/> | ||
| </cascade> | ||
| <order-by> | ||
| <order-by-field name="number" direction="ASC" /> |
Member
There was a problem hiding this comment.
Revert: use your own mapping file/scenario here please
Ocramius
suggested changes
Mar 21, 2018
Member
Ocramius
left a comment
There was a problem hiding this comment.
Test additions are still needed here
45b8089 to
762a9ac
Compare
762a9ac to
2560d4f
Compare
Contributor
Author
|
@Ocramius I've added a test, this was what you expect ? |
Member
|
@Awkan yep, this matches, thanks 👍 |
Ocramius
approved these changes
Mar 22, 2018
jwage
approved these changes
Mar 22, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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=ASCisn't set by default.Solution
In this PR, I define the default direction to
ASCif not set