/** * Generates password hash and security tokens * @param bool $insert * @return bool * @throws \yii\base\Exception * @throws \yii\base\InvalidConfigException */ public function beforeSave($insert) { $this->isNewRecord = $this->getIsNewRecord(); if ($this->isNewRecord) { $this->password = Yii::$app->security->generatePasswordHash($this->password); } return parent::beforeSave($insert); }
/** * @inheritdoc */ public function beforeSave($insert) { $this->isNewRecord = $this->getIsNewRecord(); return parent::beforeSave($insert); }