getRawUser()->andOnCondition(['user.is_archive' => false]); } public function getRawUser() { return $this->hasOne(User::class, ['id' => 'user_id']); } public function getAgreement() { return $this->hasOne(AdmissionAgreement::class, ['id' => 'agreement_id']); } public function getAgreementDecline() { return $this->getRawAgreementDecline() ->active(); } public function getRawAgreementDecline() { return $this->hasOne(AgreementDecline::class, ['agreement_id' => 'id']) ->via('agreement') ->orderBy([AgreementDecline::tableName() . '.archive' => SORT_ASC]); } public function afterValidate() { (new LoggingAfterValidateHandler()) ->setModel($this) ->invoke(); } }