/** * @return \yii\db\ActiveQuery */ public function getCategoriesSecond() { return $this->hasMany(ProjectCategoriesSecond::className(), ['project_id' => 'id']); }
private function getCategoriesListSecondIds($id) { $arr = []; $models = ProjectCategoriesSecond::find()->andWhere(['project_id' => $id])->all(); foreach ($models as $model) { $arr[] = $model->category_id; } return $arr; }