RevisionableStorageInterface.php 1.8 KB

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