protected function getExpectedGetRelationshipResponse($relationship_field_name, EntityInterface
$entity = NULL
) { $entity =
$entity ?:
$this->entity;
$access = AccessResult::
neutral()->
addCacheContexts($entity->
getEntityType()->
isRevisionable() ?
['url.query_args:resourceVersion'
] :
[]);
$access =
$access->
orIf(static::
entityFieldAccess($entity,
$this->resourceType->
getInternalName($relationship_field_name), 'view',
$this->account
));
if (!
$access->
isAllowed()) { $via_link = Url::
fromRoute( sprintf('jsonapi.%s.%s.relationship.get',
static::
$resourceTypeName,
$relationship_field_name),
['entity' =>
$entity->
uuid()] );
return static::
getAccessDeniedResponse($this->entity,
$access,
$via_link,
$relationship_field_name, 'The current user is not allowed to view this relationship.', FALSE
);
} $expected_document =
$this->
getExpectedGetRelationshipDocument($relationship_field_name,
$entity);
$expected_cacheability =
(new CacheableMetadata()) ->
addCacheTags(['http_response'
]) ->
addCacheContexts([ 'url.site',
'url.query_args:include',
'url.query_args:fields',
]) ->
addCacheableDependency($entity) ->
addCacheableDependency($access);