interface VersionNegotiatorInterface

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

Defines the common interface for all version negotiators.

@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 VersionNegotiatorInterface

All classes that implement VersionNegotiatorInterface

See also

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

jsonapi.api.php

\Drupal\jsonapi\Revisions\VersionNegotiator

File

core/modules/jsonapi/src/Revisions/VersionNegotiatorInterface.php, line 18

Namespace

Drupal\jsonapi\Revisions
View source
interface VersionNegotiatorInterface {
    
    /**
     * Gets the identified revision.
     *
     * The JSON:API module exposes revisions in terms of RFC5829. As such, the
     * public API always refers to "versions" and "working copies" instead of
     * "revisions". There are multiple ways to request a specific revision. For
     * example, one might like to load a particular revision by its ID. On the
     * other hand, it may be useful if an HTTP consumer is able to always request
     * the "latest version" regardless of its ID. It is possible to imagine other
     * scenarios as well, like fetching a revision based on a date or time.
     *
     * Each version negotiator provides one of these strategies and is able to map
     * a version argument to an existing revision.
     *
     * @param \Drupal\Core\Entity\EntityInterface $entity
     *   The entity for which a revision should be resolved.
     * @param string $version_argument
     *   A value used to derive a revision for the given entity.
     *
     * @return \Drupal\Core\Entity\EntityInterface
     *   The identified entity revision.
     *
     * @throws \Drupal\jsonapi\Revisions\VersionNotFoundException
     *   When the revision does not exist.
     * @throws \Drupal\jsonapi\Revisions\InvalidVersionIdentifierException
     *   When the revision ID is invalid.
     */
    public function getRevision(EntityInterface $entity, $version_argument);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
VersionNegotiatorInterface::getRevision public function Gets the identified revision. 1

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