-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: attribute association override default values not set for joinColumns and inverseJoinColumns if joinTable is set for a many-to-many association #9884
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
Conversation
|
You can use |
|
Sorry didn't mean to close 😅 |
1bd84b8 to
0cd672c
Compare
|
Thanks for the quick review @greg0ire! 🙂 |
If there is an attribute association override with only a join table for a many-to-many association, default values for join columns and inverse join columns will not be set.
In an attribute association override with a join table, when there is no value for joinColumns and inverseJoinColumns, set it to null instead of an empty array. It will allow the method _validateAndCompleteManyToManyMapping to set the default values instead of keeping the empty array.
0cd672c to
097c204
Compare
|
There hasn't been any activity on this pull request in the past 90 days, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days. |
|
This pull request was closed due to inactivity. |
This PR fixes a bug when an attribute association override is used for a many-to-many association with only a join table set.
In this case,
joinColumnsandinverseJoinColumnswill be set to an empty array:orm/lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php
Lines 487 to 488 in f79ec43
Later on, in the method
_validateAndCompleteManyToManyMapping, default values will not be set and the empty arrays will be kept because ofisset:orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
Lines 2056 to 2064 in f79ec43
The first commit adds a failing test. You can see that the configuration works for all the mappings (PHP, XML, annotations...) excepted the attribute mapping.
The second commit fixes it by using
nullinstead of empty arrays.Related PR (introducing the bug): #9241
@beberlei if you can have a look at this PR since you wrote the code 🙂