Mercurial > hg > isophonics-drupal-site
comparison core/modules/jsonapi/src/Revisions/VersionNegotiatorInterface.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\jsonapi\Revisions; | |
4 | |
5 use Drupal\Core\Entity\EntityInterface; | |
6 | |
7 /** | |
8 * Defines the common interface for all version negotiators. | |
9 * | |
10 * @internal JSON:API maintains no PHP API since its API is the HTTP API. This | |
11 * class may change at any time and this will break any dependencies on it. | |
12 * | |
13 * @see https://www.drupal.org/project/jsonapi/issues/3032787 | |
14 * @see jsonapi.api.php | |
15 * | |
16 * @see \Drupal\jsonapi\Revisions\VersionNegotiator | |
17 */ | |
18 interface VersionNegotiatorInterface { | |
19 | |
20 /** | |
21 * Gets the identified revision. | |
22 * | |
23 * The JSON:API module exposes revisions in terms of RFC5829. As such, the | |
24 * public API always refers to "versions" and "working copies" instead of | |
25 * "revisions". There are multiple ways to request a specific revision. For | |
26 * example, one might like to load a particular revision by its ID. On the | |
27 * other hand, it may be useful if an HTTP consumer is able to always request | |
28 * the "latest version" regardless of its ID. It is possible to imagine other | |
29 * scenarios as well, like fetching a revision based on a date or time. | |
30 * | |
31 * Each version negotiator provides one of these strategies and is able to map | |
32 * a version argument to an existing revision. | |
33 * | |
34 * @param \Drupal\Core\Entity\EntityInterface $entity | |
35 * The entity for which a revision should be resolved. | |
36 * @param string $version_argument | |
37 * A value used to derive a revision for the given entity. | |
38 * | |
39 * @return \Drupal\Core\Entity\EntityInterface | |
40 * The identified entity revision. | |
41 * | |
42 * @throws \Drupal\jsonapi\Revisions\VersionNotFoundException | |
43 * When the revision does not exist. | |
44 * @throws \Drupal\jsonapi\Revisions\InvalidVersionIdentifierException | |
45 * When the revision ID is invalid. | |
46 */ | |
47 public function getRevision(EntityInterface $entity, $version_argument); | |
48 | |
49 } |