public function canDelete() { $model = \app\records\DolzhnostFizLicaNaRabote::findOne($this->id); if (!$model) { return false; } return !$model->getKursy_fiz_lica_rel()->exists(); }
/** * @return ActiveQuery */ public function getDolzhnosti_fiz_lica_na_rabote_rel() { return $this->hasMany(DolzhnostFizLicaNaRabote::className(), ['rabota_fiz_lica' => 'id'])->inverseOf('rabota_fiz_lica_rel'); }