feat: add new setter/getter for Entity - #7230
Conversation
4ca42db to
e977ae9
Compare
|
I'm not sure what this is needed for? |
|
For method name collision. #5762 (comment) |
|
I meant the colons in the value, but now I see those are an artifact of the test fixture, not part of the code! My mistake. |
e977ae9 to
8006f5f
Compare
|
Added docs. |
8006f5f to
6f52f1e
Compare
|
@mostafakhudair @najdanovicivan @iRedds @the-gt99 @lonnieezell |
|
I think this adds a lot of unnecessary complexity to have multiple ways of defining setters. So far the only problem we have is when we need to override setAttributes method. Since now we have setAttributes as deprecated and we're going forward with injectRawData() method. I'd rather use https://www.php.net/manual/en/reflectionmethod.getdeclaringclass.php to check if setAttributes is not from CodeIgniter\Entity or CodeIgniter\Entity\Entity class. So if method is not from base CI4 classes it can be handled as regular setter for $this->attributes['attributes']. The only problem with this one is BC in Entity classes which override the setAttributes method. |
|
@najdanovicivan Thank you for your opinion. The main reason of this PR is to avoid setter/getter method name conflicts, |
|
As far as I remember, PSR does not recommend using the underscore character as a prefix for method names. |
|
We don't remove If there are columns |
Needs #7208Description
Add special getter/setter to Entity to avoid method name conflicts.
_set+ key" for a attribute_get+ key" for a attributeChecklist: