validation_extender = new ParentPassportDataValidation([ 'model' => $this ]); $this->validation_extender->modelPreparationCallback(); } public function rules() { return ArrayHelper::merge(parent::rules(), $this->validation_extender->getRules()); } public function getParentData() { return $this->hasOne(ParentData::class, ['passport_data_id' => 'id'])->andWhere(['archive' => false]); } public function setUserForInitialization(User $user) { $this->userForInitialization = $user; } public function getAbiturientQuestionary() { if ($this->parentData === null && isset($this->userForInitialization)) { return $this->userForInitialization->getAbiturientQuestionary(); } return $this->hasOne(AbiturientQuestionary::class, ['id' => 'questionary_id']) ->viaTable('parent_data', ['passport_data_id' => 'id']); } public function getEntityIdentifier(): ?string { return Yii::t( 'abiturient/questionary/parent-passport-data', 'Идентификатор модели: `Паспортные данные родителя или законного представителя`' ); } protected static function setQuestionaryLink(PassportData $model, ?int $questionary_id) { return; } public function setScenarioForUpdateFromRaw() { $this->validation_extender->modelPreparationCallback(); } }