Pull merge.
[yaffs-website] / web / core / lib / Drupal / Core / Entity / RevisionableStorageInterface.php
1 <?php
2
3 namespace Drupal\Core\Entity;
4
5 /**
6  * A storage that supports revisionable entity types.
7  */
8 interface RevisionableStorageInterface {
9
10   /**
11    * Creates a new revision starting off from the specified entity object.
12    *
13    * @param \Drupal\Core\Entity\EntityInterface|\Drupal\Core\Entity\RevisionableInterface $entity
14    *   The revisionable entity object being modified.
15    * @param bool $default
16    *   (optional) Whether the new revision should be marked as default. Defaults
17    *   to TRUE.
18    *
19    * @return \Drupal\Core\Entity\EntityInterface|\Drupal\Core\Entity\RevisionableInterface
20    *   A new entity revision object.
21    */
22   public function createRevision(RevisionableInterface $entity, $default = TRUE);
23
24   /**
25    * Loads a specific entity revision.
26    *
27    * @param int $revision_id
28    *   The revision ID.
29    *
30    * @return \Drupal\Core\Entity\EntityInterface|null
31    *   The specified entity revision or NULL if not found.
32    */
33   public function loadRevision($revision_id);
34
35   /**
36    * Loads multiple entity revisions.
37    *
38    * @param array $revision_ids
39    *   An array of revision IDs to load.
40    *
41    * @return \Drupal\Core\Entity\EntityInterface[]
42    *   An array of entity revisions keyed by their revision ID, or an empty
43    *   array if none found.
44    */
45   public function loadMultipleRevisions(array $revision_ids);
46
47   /**
48    * Deletes a specific entity revision.
49    *
50    * A revision can only be deleted if it's not the currently active one.
51    *
52    * @param int $revision_id
53    *   The revision ID.
54    */
55   public function deleteRevision($revision_id);
56
57   /**
58    * Returns the latest revision identifier for an entity.
59    *
60    * @param int|string $entity_id
61    *   The entity identifier.
62    *
63    * @return int|string|null
64    *   The latest revision identifier or NULL if no revision could be found.
65    */
66   public function getLatestRevisionId($entity_id);
67
68 }