Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[PropertyAccessor] Fix unable to write to singular property using setter while plural adder/remover exist#28966
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…ter while plural adder/remover exist
karser commentedOct 31, 2018
@nicolas-grekas This bug exists in 4.1 and master, is this PR going to be merged in there as well? |
nicolas-grekas commentedNov 6, 2018
@karser yes: we regularly merge lower branches into upper ones. |
nicolas-grekas commentedNov 15, 2018
Thank you@karser. |
…y using setter while plural adder/remover exist (karser)This PR was merged into the 3.4 branch.Discussion----------[PropertyAccessor] Fix unable to write to singular property using setter while plural adder/remover exist| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#28961| License | MITPlease take a look at the tests I added - they describe the issue. It has to do with the priorities: `findAdderAndRemover('User', 'email')` is called earlier than `$this->isMethodAccessible('User', 'setEmail', 1)`Commits-------8238f16 [PropertyAccessor] Fix unable to write to singular property using setter while plural adder/remover exist
bendavies commentedNov 26, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I think we have a problem here which has caused a regression, or at least a change in behaviour. If you have a collection property which has a setter, an adder and a remover: class Foo{private$invoices = [];publicfunctionsetInvoices(array$invoices):void {//... }publicfunctionaddInvoice(Invoice$invoice):void {//... }publicfunctionremoveInvoice(Invoice$item):void {//... }} prior to this change, the adder/remover were used over the setter, but with this change, the setter is prioritized over the adder/remover. Yes, Is this an intended, acceptable consequence? |
Uh oh!
There was an error while loading.Please reload this page.
Please take a look at the tests I added - they describe the issue. It has to do with the priorities:
findAdderAndRemover('User', 'email')is called earlier than$this->isMethodAccessible('User', 'setEmail', 1)