annotate core/lib/Drupal/Core/Entity/RevisionableInterface.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 1fec387a4317
rev   line source
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@0 55 * Acts on a revision before it gets saved.
Chris@0 56 *
Chris@0 57 * @param EntityStorageInterface $storage
Chris@0 58 * The entity storage object.
Chris@0 59 * @param \stdClass $record
Chris@0 60 * The revision object.
Chris@0 61 */
Chris@0 62 public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record);
Chris@0 63
Chris@0 64 }