Since: 2.0
Author: Qiang Xue (qiang.xue@gmail.com)
示例#1
0
 /**
  * Serializes a model object.
  * @param Arrayable $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);
     }
 }
示例#2
0
 /**
  * Serializes a model object.
  * @param Arrayable $model
  * @return array the array representation of the model
  */
 protected function serializeModel($model)
 {
     return $model->toArray();
 }
示例#3
0
 /**
  * Serializes a model object.
  * @param \yii\base\Arrayable $model
  * @return array the array representation of the model
  */
 protected function serializeModel($model)
 {
     list($fields, $expand) = $this->getRequestedFields();
     return $model->toArray($fields, $expand);
 }
示例#4
0
 /**
  * Serializes a model object.
  * @param Arrayable $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 ['success' => 1, 'message' => \Yii::$app->response->statusText, 'status' => \Yii::$app->response->getStatusCode(), $this->collectionEnvelope => $model->toArray($fields, $expand)];
     }
 }