protected function getIdFaculty($id, $parent = false) { if ($parent) { $model = DisciplineName::findOne($id); return $model->idProgram->id_faculty; } else { $model = DisciplineFile::find()->where(['id_file' => $id])->one(); return $this->getIdFaculty($model->id_discipline_name, true); } }
/** * @return \yii\db\ActiveQuery */ public function getDisciplineFiles() { return $this->hasMany(DisciplineFile::className(), ['id_discipline_name' => 'id']); }