rest\Serializer $collectionEnvelope

$collectionEnvelope public property

The name of the envelope (e.g. items) for returning the resource objects in a collection. This is used when serving a resource collection. When this is set and pagination is enabled, the serializer will return a collection in the following format:

[
    'items' => [...],  // assuming collectionEnvelope is "items"
    '_links' => {  // pagination links as returned by Pagination::getLinks()
        'self' => '...',
        'next' => '...',
        'last' => '...',
    },
    '_meta' => {  // meta information as returned by Pagination::toArray()
        'totalCount' => 100,
        'pageCount' => 5,
        'currentPage' => 1,
        'perPage' => 20,
    },
]

If this property is not set, the resource arrays will be directly returned without using envelope. The pagination information as shown in _links and _meta can be accessed from the response HTTP headers.

doc_Yii
2016-10-30 17:11:07
Comments
Leave a Comment

Please login to continue.