/**
  * @inheritdoc
  */
 public function set(Model $model)
 {
     if (Yii::$app->user->getIsGuest()) {
         return;
     }
     $data = $model->toArray();
     $this->getStorage()->setBounded('theme', $data);
     $this->setToCache($data);
 }
示例#2
0
 /**
  * Serializes a model object.
  * @param Model $model
  * @return array the array representation of the model
  */
 protected function serializeModel($model)
 {
     if ($this->request->getIsHead()) {
         return null;
     } else {
         list($fields, $expand) = $this->getRequestedFields();
         return $model->toArray($fields, $expand);
     }
 }
 /**
  * @param Model $model the settings model
  */
 public function set(Model $model)
 {
     $data = $model->toArray();
     Yii::$app->session->set($this->sessionKey, $data);
 }