Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\Core\Entity;
|
Chris@0
|
4
|
Chris@0
|
5 /**
|
Chris@0
|
6 * Provides methods for an entity to support revisions.
|
Chris@0
|
7 */
|
Chris@0
|
8 interface RevisionableInterface {
|
Chris@0
|
9
|
Chris@0
|
10 /**
|
Chris@0
|
11 * Determines whether a new revision should be created on save.
|
Chris@0
|
12 *
|
Chris@0
|
13 * @return bool
|
Chris@0
|
14 * TRUE if a new revision should be created.
|
Chris@0
|
15 *
|
Chris@0
|
16 * @see \Drupal\Core\Entity\EntityInterface::setNewRevision()
|
Chris@0
|
17 */
|
Chris@0
|
18 public function isNewRevision();
|
Chris@0
|
19
|
Chris@0
|
20 /**
|
Chris@0
|
21 * Enforces an entity to be saved as a new revision.
|
Chris@0
|
22 *
|
Chris@0
|
23 * @param bool $value
|
Chris@0
|
24 * (optional) Whether a new revision should be saved.
|
Chris@0
|
25 *
|
Chris@0
|
26 * @throws \LogicException
|
Chris@0
|
27 * Thrown if the entity does not support revisions.
|
Chris@0
|
28 *
|
Chris@0
|
29 * @see \Drupal\Core\Entity\EntityInterface::isNewRevision()
|
Chris@0
|
30 */
|
Chris@0
|
31 public function setNewRevision($value = TRUE);
|
Chris@0
|
32
|
Chris@0
|
33 /**
|
Chris@0
|
34 * Gets the revision identifier of the entity.
|
Chris@0
|
35 *
|
Chris@0
|
36 * @return
|
Chris@0
|
37 * The revision identifier of the entity, or NULL if the entity does not
|
Chris@0
|
38 * have a revision identifier.
|
Chris@0
|
39 */
|
Chris@0
|
40 public function getRevisionId();
|
Chris@0
|
41
|
Chris@0
|
42 /**
|
Chris@0
|
43 * Checks if this entity is the default revision.
|
Chris@0
|
44 *
|
Chris@0
|
45 * @param bool $new_value
|
Chris@0
|
46 * (optional) A Boolean to (re)set the isDefaultRevision flag.
|
Chris@0
|
47 *
|
Chris@0
|
48 * @return bool
|
Chris@0
|
49 * TRUE if the entity is the default revision, FALSE otherwise. If
|
Chris@0
|
50 * $new_value was passed, the previous value is returned.
|
Chris@0
|
51 */
|
Chris@0
|
52 public function isDefaultRevision($new_value = NULL);
|
Chris@0
|
53
|
Chris@0
|
54 /**
|
Chris@14
|
55 * Checks whether the entity object was a default revision when it was saved.
|
Chris@14
|
56 *
|
Chris@14
|
57 * @return bool
|
Chris@14
|
58 * TRUE if the entity object was a revision, FALSE otherwise.
|
Chris@14
|
59 */
|
Chris@14
|
60 public function wasDefaultRevision();
|
Chris@14
|
61
|
Chris@14
|
62 /**
|
Chris@14
|
63 * Checks if this entity is the latest revision.
|
Chris@14
|
64 *
|
Chris@14
|
65 * @return bool
|
Chris@14
|
66 * TRUE if the entity is the latest revision, FALSE otherwise.
|
Chris@14
|
67 */
|
Chris@14
|
68 public function isLatestRevision();
|
Chris@14
|
69
|
Chris@14
|
70 /**
|
Chris@0
|
71 * Acts on a revision before it gets saved.
|
Chris@0
|
72 *
|
Chris@0
|
73 * @param EntityStorageInterface $storage
|
Chris@0
|
74 * The entity storage object.
|
Chris@0
|
75 * @param \stdClass $record
|
Chris@0
|
76 * The revision object.
|
Chris@0
|
77 */
|
Chris@0
|
78 public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record);
|
Chris@0
|
79
|
Chris@0
|
80 }
|