rest\Serializer serializeModelErrors()

serializeModelErrors() protected method Serializes the validation errors in a model. protected array serializeModelErrors ( $model )$model yii\base\Model return array The array representation of the errors

rest\Serializer serialize()

serialize() public method Serializes the given data into a format that can be easily turned into other formats. This method mainly converts the objects of recognized types into array representation. It will not do conversion for unknown object types or non-object data. The default implementation will handle yii\base\Model and yii\data\DataProviderInterface. You may override this method to support more object types. public mixed serialize ( $data )$data mixed The data to be serialized. r

rest\Serializer init()

init() public method Initializes the object. This method is invoked at the end of the constructor after the object is initialized with the given configuration. public void init ( )

rest\Serializer addPaginationHeaders()

addPaginationHeaders() protected method Adds HTTP headers about the pagination to the response. protected void addPaginationHeaders ( $pagination )$pagination yii\data\Pagination

rest\Serializer getRequestedFields()

getRequestedFields() protected method See also: yii\base\Model::fields() yii\base\Model::extraFields() protected array getRequestedFields ( )return array The names of the requested fields. The first element is an array representing the list of default fields requested, while the second element is an array of the extra fields requested in addition to the default fields.

rest\Serializer $totalCountHeader

$totalCountHeader public property The name of the HTTP header containing the information about total number of data items. This is used when serving a resource collection with pagination. public string $totalCountHeader = 'X-Pagination-Total-Count'

rest\Serializer $response

$response public property The response to be sent. If not set, the response application component will be used. public yii\web\Response $response = null

rest\Serializer $preserveKeys

$preserveKeys public property (available since version 2.0.10) Whether to preserve array keys when serializing collection data. Set this to true to allow serialization of a collection as a JSON object where array keys are used to index the model objects. The default is to serialize all collections as array, regardless of how the array is indexed. See also serializeDataProvider(). public boolean $preserveKeys = false

rest\Serializer $request

$request public property The current request. If not set, the request application component will be used. public yii\web\Request $request = null

rest\Serializer $pageCountHeader

$pageCountHeader public property The name of the HTTP header containing the information about total number of pages of data. This is used when serving a resource collection with pagination. public string $pageCountHeader = 'X-Pagination-Page-Count'