protected static function VersionNegotiator::throwNotFoundHttpException in JSON:API 8.2
Throws a cacheable error exception.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity for which a revision was requested.
string $resource_version_identifier: The user input for the revision negotiation.
Throws
\Drupal\Core\Http\Exception\CacheableNotFoundHttpException
1 call to VersionNegotiator::throwNotFoundHttpException()
- VersionNegotiator::getRevision in src/
Revisions/ VersionNegotiator.php - Gets a negotiated entity revision.
File
- src/
Revisions/ VersionNegotiator.php, line 92
Class
- VersionNegotiator
- Provides a version negotiator manager.
Namespace
Drupal\jsonapi\RevisionsCode
protected static function throwNotFoundHttpException(EntityInterface $entity, $resource_version_identifier) {
$cacheability = CacheableMetadata::createFromObject($entity)
->addCacheContexts([
'url.path',
'url.query_args:' . ResourceVersionRouteEnhancer::RESOURCE_VERSION_QUERY_PARAMETER,
]);
$reason = sprintf('The requested version, identified by `%s`, could not be found.', $resource_version_identifier);
throw new CacheableNotFoundHttpException($cacheability, $reason);
}