CodeExplorer getResponses example
if (!
static::
collectionHasResourceIdentifier($resource_identifier,
$data['already_checked'
])) { $data['already_checked'
][] =
$resource_identifier;
$via_link = Url::
fromRoute( sprintf('jsonapi.%s.individual',
$resource_identifier['type'
]),
['entity' =>
$resource_identifier['id'
]] );
$collected_responses[] =
static::
getAccessDeniedResponse($entity,
$target_access,
$via_link, NULL, NULL, '/data'
);
} break;
} } $psr_responses =
$this->
getResponses([static::
getRelatedLink(static::
toResourceIdentifier($entity),
$public_field_name)],
$request_options);
$collected_responses[] =
static::
toCollectionResourceResponse(static::
toResourceResponses($psr_responses), NULL, TRUE
);
$entity =
$entity->
{$field_name}->entity;
} if (!
empty($collected_responses)) { $data['responses'
][$path] =
static::
toCollectionResourceResponse($collected_responses, NULL, TRUE
);
} return $data;
},
['responses' =>
[], 'already_checked' =>
[]]);
$individual_document =
$this->
getExpectedDocument();
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);