Open Tigrov opened 6 months ago
Great ideas, especially with naming for relations. I have a question:
What's the reason to rename attributes
to properties
?
What's the reason to rename
attributes
toproperties
?
It was discussed that there is confusion between the $attributes
AR property and PHP's #[Attribute]
.
But it's a good question. Now this looks doubtful due to major changes and needs to be discussed again. Due to the renaming of public methods whose names contain attribute
.
But it's a good question. Now this looks doubtful due to major changes and needs to be discussed again. Due to the renaming of public methods whose names contain
attribute
.
Are there any pitfalls here? Rename methods also it looks logically.
Are there any pitfalls here? Rename methods also it looks logically.
Discussion about renaming $attributes
moved to https://github.com/yiisoft/active-record/issues/343
BaseActiveRecord
class toAbstractActiveRecord
AbstractActiveRecord
class implements onlyActiveRecordInterface
ActiveRecord
class$properties
with magic methods__get()
,__set()
,__isset()
,__unset()
toMagicPropertiesTrait
and use it inActiveRecord
classAbstractActiveRecord
via$this->$name
only~ActiveQueryInterface
use method with prefixget
and suffixQuery
, e.g.getOrderQuery(): ActiveQueryInterface
instead ofgetOrder(): ActiveQueryInterface
get
, e.g.getOrder(): ActiveRecordInterface|null
getRelation(): ActiveQueryInterface
torelationQuery(): ActiveQueryInterface
relation(string $name): ActiveRecordInterface|null {return $this->related[$name] ?? null;}