public function init() { parent::init(); if (empty($this->attributes)) { $this->attributes = [BaseActiveRecord::EVENT_BEFORE_INSERT => [$this->generatedAttribute], BaseActiveRecord::EVENT_BEFORE_UPDATE => [$this->generatedAttribute]]; } }