throw new CacheableBadRequestHttpException($cacheability,
$message);
} // Whether the collection to be loaded should include only working copies.
$defaults[static::WORKING_COPIES_REQUESTED
] =
$resource_version_identifier ===
$working_copy_identifier;
return $defaults;
} /** @var \Drupal\Core\Entity\EntityInterface $entity */
$entity =
$defaults['entity'
];
/** @var \Drupal\jsonapi\Revisions\VersionNegotiatorInterface $negotiator */
$resolved_revision =
$this->versionNegotiator->
getRevision($entity,
$resource_version_identifier);
// Ensure none of the original entity cacheability is lost, especially the
// query argument's cache context.
$resolved_revision->
addCacheableDependency($entity);
return ['entity' =>
$resolved_revision] +
$defaults;
} /**
* Validates the user input.
*
* @param string $resource_version
* The requested resource version identifier.
*
* @return bool
* TRUE if the received resource version value is valid, FALSE otherwise.
*/