function VersionNegotiator::throwNotFoundHttpException
Same name in other branches
- 9 core/modules/jsonapi/src/Revisions/VersionNegotiator.php \Drupal\jsonapi\Revisions\VersionNegotiator::throwNotFoundHttpException()
- 8.9.x core/modules/jsonapi/src/Revisions/VersionNegotiator.php \Drupal\jsonapi\Revisions\VersionNegotiator::throwNotFoundHttpException()
- 11.x core/modules/jsonapi/src/Revisions/VersionNegotiator.php \Drupal\jsonapi\Revisions\VersionNegotiator::throwNotFoundHttpException()
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 core/
modules/ jsonapi/ src/ Revisions/ VersionNegotiator.php - Gets a negotiated entity revision.
File
-
core/
modules/ jsonapi/ 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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.