Ejemplo n.º 1
0
 /**
  * Finds the Specialty model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Specialty the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Specialty::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 2
0
 public static function getList($specialty_id = null, $physician_id = null)
 {
     if ($specialty_id !== null) {
         $specialty = Specialty::findOne($specialty_id);
         if ($specialty !== null && $physician_id !== null) {
             $model = static::findOne($physician_id);
             if ($model !== null && $specialty->is_therapist) {
                 return [$model->physician_id => $model->fullName];
             }
         }
     }
     $models = $specialty_id === null ? static::find()->all() : static::find()->where(['specialty_id' => $specialty_id])->all();
     return ArrayHelper::map($models, 'physician_id', 'fullName');
 }