Пример #1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->modelClass === null) {
         throw new InvalidConfigException('The "modelClass" property must be set.');
     }
 }
Пример #2
0
 public function init()
 {
     parent::init();
     $request = wanhunet::$app->request;
     if (!$request->isGet) {
         $params = json_decode(file_get_contents('php://input'), true);
         $request->setBodyParams($params);
     }
 }
Пример #3
0
 /**
  * @throws \yii\web\HttpException
  */
 public function init()
 {
     if ($this->modelClass === null) {
         throw new InvalidConfigException(get_class($this) . '::$modelClass must be set.');
     }
     if ($this->searchFormClass === null) {
         throw new InvalidConfigException(get_class($this) . '::$searchFormClass must be set.');
     }
     parent::init();
 }
Пример #4
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (isset($_GET['type']) && ($typeItem = Yii::$app->collectors['types']->getOne($_GET['type'])) && ($type = $typeItem->object) && !empty($type) && $type->enableApiAccess) {
         $this->modelClass = $type->primaryModel;
     }
     if ($this->modelClass === null) {
         throw new ForbiddenHttpException('Unable to access the object type \'' . (isset($_GET['type']) ? $_GET['type'] : 'unknown') . '\'.');
     }
 }
Пример #5
0
 public function init()
 {
     parent::init();
     \Yii::$app->user->enableSession = false;
     \Yii::$app->user->loginUrl = null;
     \Yii::$app->response->on('beforeSend', function ($event) {
         $response = $event->sender;
         if ($response->data !== null and !$response->isSuccessful) {
             $response->data = ['status' => $response->statusCode, 'message' => $response->statusText, 'success' => (int) $response->isSuccessful, 'data' => $response->data];
         }
     });
 }
Пример #6
0
 public function init()
 {
     parent::init();
     Yii::$app->response->format = Response::FORMAT_JSON;
 }
Пример #7
0
 public function init(){
     $this->_startTime = microtime(true);
     parent::init();
 }
Пример #8
0
 public function init()
 {
     parent::init();
 }
Пример #9
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     $this->basket = $this->module->basket;
     parent::init();
 }