class VersionById

Same name in other branches
  1. 9 core/modules/jsonapi/src/Revisions/VersionById.php \Drupal\jsonapi\Revisions\VersionById
  2. 8.9.x core/modules/jsonapi/src/Revisions/VersionById.php \Drupal\jsonapi\Revisions\VersionById
  3. 10 core/modules/jsonapi/src/Revisions/VersionById.php \Drupal\jsonapi\Revisions\VersionById

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

Expanded class hierarchy of VersionById

See also

https://www.drupal.org/project/drupal/issues/3032787

jsonapi.api.php

1 file declares its use of VersionById
VersionNegotiatorTest.php in core/modules/jsonapi/tests/src/Kernel/Revisions/VersionNegotiatorTest.php
1 string reference to 'VersionById'
jsonapi.services.yml in core/modules/jsonapi/jsonapi.services.yml
core/modules/jsonapi/jsonapi.services.yml
1 service uses VersionById
jsonapi.version_negotiator.id in core/modules/jsonapi/jsonapi.services.yml
Drupal\jsonapi\Revisions\VersionById

File

core/modules/jsonapi/src/Revisions/VersionById.php, line 16

Namespace

Drupal\jsonapi\Revisions
View 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

Title Sort descending Modifiers Object type Summary Overriden Title
NegotiatorBase::$entityTypeManager protected property The entity type manager to load the revision.
NegotiatorBase::ensureVersionExists protected static function Helper method that ensures that a version exists.
NegotiatorBase::getRevision public function Gets the identified revision. Overrides VersionNegotiatorInterface::getRevision
NegotiatorBase::loadRevision protected function Loads an entity revision.
NegotiatorBase::__construct public function Constructs a version negotiator instance.
VersionById::getRevisionId protected function Gets the revision ID. Overrides NegotiatorBase::getRevisionId

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.