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