You are a developer and looking for Shopware projects?
Apply Now!
getResourceLinks example
protected
function
getExpectedCollectionResponse
(
array
$collection
,
$self_link
, array
$request_options
, array
$included_paths
= NULL,
$filtered
= FALSE
)
{
$resource_identifiers
=
array_map
(
[
static
::
class
, 'toResourceIdentifier'
]
,
$collection
)
;
$individual_responses
=
static
::
toResourceResponses
(
$this
->
getResponses
(
static
::
getResourceLinks
(
$resource_identifiers
)
,
$request_options
)
)
;
$merged_response
=
static
::
toCollectionResourceResponse
(
$individual_responses
,
$self_link
, TRUE
)
;
$merged_document
=
$merged_response
->
getResponseData
(
)
;
if
(
!
isset
(
$merged_document
[
'data'
]
)
)
{
$merged_document
[
'data'
]
=
[
]
;
}
$cacheability
=
static
::
getExpectedCollectionCacheability
(
$this
->account,
$collection
, NULL,
$filtered
)
;
$cacheability
->
setCacheMaxAge
(
$merged_response
->
getCacheableMetadata
(
)
->
getCacheMaxAge
(
)
)
;
$collection_response
=
new
CacheableResourceResponse
(
$merged_document
)
;