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