Пример #1
0
 public static function one($id)
 {
     $q = self::CONFIG_PATH . '.' . $id;
     $data = [];
     foreach (\Yii::$app->settings->all as $n => $v) {
         if (substr($n, 0, strlen($q)) !== $q) {
             continue;
         }
         $path = explode('.', $n);
         $data[$path[3]] = $v;
     }
     $item = new AuthClientModel();
     $item->class = $data['class'];
     unset($data['class']);
     $item->_client = $data;
     $item->loadEntity();
     return $item;
 }
Пример #2
0
 /**
  * Finds the AuthClientModel model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return AuthClientModel the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = AuthClientModel::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }