-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix setting model attribute with setter to use setter #11401
Conversation
Can you please merge your efforts with #11320 into one PR. Amend CHENGELOG, update tests, explain a bit more what issue can be solved (or what feature can be introduced) with your PR, etc. Thanks. |
Sorry I didn't even notice that PR. This PR is strictly about looking for a setter when assigning a value directly to a hidden property. That PR solves some other things too. Basically, Phalcon supports defining getters/setters for model attributes that are called automatically when they are retrieved and/or set. The problem is, when the attribute is set directly it is not called, instead the attribute is assigned whatever value is being passed. This would fix Issue #11286. Feel free to close if the other PR precedes this one (although feel free to take the test from this one and use in the other one too). |
@sergeyklay what do you think should be done? This change should be completely compatible with 2.0.x and master as well... |
Can you please rebase? |
@sergeyklay done (I'm pretty sure). Thanks. |
$this->_executeSetGet(); | ||
} | ||
|
||
/*public function testModelsPostgresql() |
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.
Why are these commented out?
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.
Because this doesn't really touch the database anyhow (it just checks the getters/setters for the model object).
Could you please submit just the commits that belong to the PR? |
@sergeyklay done. I messed up with my git rebasing which caused that issue but should be fully fixed and up to date now. |
Fix setting model attribute with setter to use setter
Thanks |
This syncs up the behavior with assign() and setting the value directly and also aligns the behavior of getting the property with setting the property. Comes with a test.