/** * @param $id * @return string * @throws NotFoundHttpException */ public function actionCompanies($id) { $bank = AbstractBank::findOne($id); if (!$bank) { throw new NotFoundHttpException('Invalid bank id'); } return $this->render('companies', ['bank' => $bank, 'companyProvider' => new ActiveDataProvider(['query' => Company::find()->with('statuses')->where(['bank_id' => $bank->id])])]); }
/** * @return \yii\db\ActiveQuery */ public function getBank() { return $this->hasOne(AbstractBank::className(), ['id' => 'bank_id']); }