/** * Finds the Comission model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @param integer $objects_id * @param integer $agents_id * @return Comission the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id, $objects_id, $agents_id) { if (($model = Comission::findOne(['id' => $id, 'objects_id' => $objects_id, 'agents_id' => $agents_id])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getComissions() { return $this->hasMany(Comission::className(), ['agents_id' => 'id']); }