Make Model::{data,dirty,scope} props private#864
Conversation
627db51 to
923dad6
Compare
7b20257 to
69257d5
Compare
| $this->onHookShort(self::HOOK_AFTER_SAVE, $checkFx, [], -10); | ||
| } | ||
|
|
||
| public function &getDataRef(): array |
There was a problem hiding this comment.
Don't we need to describe (comment) this and below method? It's quite straightforward, but still...
There was a problem hiding this comment.
I will add @internal phpdoc, method is to easy migration for #862 before we remove this internal state method completely.
|
|
||
| if (array_key_exists($field, $this->dirty)) { | ||
| $dirtyRef = &$this->getDirtyRef(); | ||
| if (array_key_exists($field, $dirtyRef)) { |
There was a problem hiding this comment.
Here we can simplify to return array_key_exists($field, $dirtyRef); don't we?
There was a problem hiding this comment.
And this method looks exaactly the same as _isset($field) method below, so to avoid code duplication we could just use return $this->_isset($field); here.
There was a problem hiding this comment.
Good catch, should be done later with another PR, probably after #862. The issue is, at least from my POV, why should be use dirty array for _isset instead of standard model data?
69257d5 to
5fc8813
Compare
5fc8813 to
d927ef5
Compare
for #862, we must have full control over these properties