ActiveRecord with Member

Hi, I like Yii2 for it’s magic and Yii3 for sticking to PSR. But I feel ActiveRecord could be a bit more Yii3 :wink:

I have problems with the ActiveRecord and attributes which are also class members. For example

class User extends ActiveRecord
{
    private int $id;

    public function getTableName(): string
    {
        return '{{%user}}';
    }

     public function getId(): int
    {
        return $this->id;
    }

    public function setId($id): void
    {
        $this->id = $id;
    }
}

dose not use the DB field id and without private int $id; it will throw “InvalidCallException: Setting read-only property”

With brute force (and setting $attributes to protected) the members will work (at least in the small test I did)

// in class User
    public function instantiate($row)
    {

        foreach ($this->attributes() as $field) {
            $this->$field = $row[$field];
            $this->attributes[$field] = &$this->$field;
        }
        return $this;
    }

Am I missing something? What is the proper way to use it?

And the members (of User) need to be protected because of offsetSet/offsetGet calls. This works for me now.