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