public function beforeValidate() { $this->name = $this->BrandName . ' ' . $this->ModelName; return parent::beforeValidate(); }
/** * @inheritdoc */ public function beforeValidate() { if (!empty($this->city_name)) { $city = City::find()->where(['name' => $this->city_name])->one(); if (!empty($city)) { $this->city_id = $city->id; } } return parent::beforeValidate(); }