3 namespace Drupal\Core\Entity;
6 * Provides methods for an entity to support revisions.
8 interface RevisionableInterface {
11 * Determines whether a new revision should be created on save.
14 * TRUE if a new revision should be created.
16 * @see \Drupal\Core\Entity\EntityInterface::setNewRevision()
18 public function isNewRevision();
21 * Enforces an entity to be saved as a new revision.
24 * (optional) Whether a new revision should be saved.
26 * @throws \LogicException
27 * Thrown if the entity does not support revisions.
29 * @see \Drupal\Core\Entity\EntityInterface::isNewRevision()
31 public function setNewRevision($value = TRUE);
34 * Gets the revision identifier of the entity.
37 * The revision identifier of the entity, or NULL if the entity does not
38 * have a revision identifier.
40 public function getRevisionId();
43 * Checks if this entity is the default revision.
45 * @param bool $new_value
46 * (optional) A Boolean to (re)set the isDefaultRevision flag.
49 * TRUE if the entity is the default revision, FALSE otherwise. If
50 * $new_value was passed, the previous value is returned.
52 public function isDefaultRevision($new_value = NULL);
55 * Acts on a revision before it gets saved.
57 * @param EntityStorageInterface $storage
58 * The entity storage object.
59 * @param \stdClass $record
60 * The revision object.
62 public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record);