class VersionById in JSON:API 8.2
Defines a revision ID implementation for entity revision ID values.
@internal JSON:API maintains no PHP API since its API is the HTTP API. This class may change at any time and this will break any dependencies on it.
Hierarchy
- class \Drupal\jsonapi\Revisions\NegotiatorBase implements VersionNegotiatorInterface
- class \Drupal\jsonapi\Revisions\VersionById implements VersionNegotiatorInterface
Expanded class hierarchy of VersionById
See also
https://www.drupal.org/project/jsonapi/issues/3032787
1 file declares its use of VersionById
- VersionNegotiatorTest.php in tests/
src/ Kernel/ Revisions/ VersionNegotiatorTest.php
1 string reference to 'VersionById'
1 service uses VersionById
File
- src/
Revisions/ VersionById.php, line 16
Namespace
Drupal\jsonapi\RevisionsView source
class VersionById extends NegotiatorBase implements VersionNegotiatorInterface {
/**
* {@inheritdoc}
*/
protected function getRevisionId(EntityInterface $entity, $version_argument) {
if (!is_numeric($version_argument)) {
throw new InvalidVersionIdentifierException('The revision ID must be an integer.');
}
return $version_argument;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NegotiatorBase:: |
protected | property | The entity type manager to load the revision. | |
NegotiatorBase:: |
protected static | function | Helper method that ensures that a version exists. | |
NegotiatorBase:: |
public | function |
Gets the identified revision. Overrides VersionNegotiatorInterface:: |
|
NegotiatorBase:: |
protected | function | Loads an entity revision. | |
NegotiatorBase:: |
public | function | Constructs a version negotiator instance. | |
VersionById:: |
protected | function |
Gets the revision ID. Overrides NegotiatorBase:: |