You are here

ConfigEntityRevisionsRevisionStorageHandlerInterface.php in Config Entity Revisions 8.2

File

src/ConfigEntityRevisionsRevisionStorageHandlerInterface.php
View source
<?php

namespace Drupal\config_entity_revisions;

use Drupal\config_entity_revisions\Entity\ConfigEntityRevisions;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\ContentEntityStorageInterface;

/**
 * Interface ConfigEntityRevisionsRevisionStorageHandlerInterface.
 *
 * @package Drupal\config_entity_revisions
 */
interface ConfigEntityRevisionsRevisionStorageHandlerInterface extends ContentEntityStorageInterface {

  /**
   * Set the config entity under consideration.
   *
   * @param \Drupal\config_entity_revisions\ConfigEntityRevisionsConfigEntityInterface $config_entity
   *   The config_entity_revisions entity.
   */
  public function setConfigEntity(ConfigEntityRevisionsConfigEntityInterface $config_entity);

  /**
   * Gets the latest published revision ID of the entity.
   *
   * @param int $ignore
   *   A revision ID to ignore.
   *
   * @return int
   *   The identifier of the latest published revision of the entity, or NULL
   *   if the entity does not have a published revision.
   */
  public function getLatestPublishedRevisionId($ignore = NULL);

  /**
   * Gets the latest published revision of the entity.
   *
   * @return RevisionableStorageInterface
   *   The identifier of the latest published revision of the entity, or NULL
   *   if the entity does not have a published revision.
   */
  public function getLatestPublishedRevision();

  /**
   * Gets the latest revision ID of the entity.
   *
   * @param int $ignore
   *   A revision ID to ignore.
   *
   * @return int
   *   The identifier of the latest published revision of the entity, or NULL
   *   if the entity does not have a published revision.
   */
  public function getLatestRevisionId($ignore = NULL);

  /**
   * Gets the latest revision of the entity.
   *
   * @param int $ignore
   *   A revision ID to ignore.
   *
   * @return int
   *   The identifier of the latest published revision of the entity, or NULL
   *   if the entity does not have a published revision.
   */
  public function getLatestRevision($ignore = NULL);

  /**
   * Gets the latest revision ID of the entity.
   *
   * @param int $ignore
   *   A revision ID to ignore.
   *
   * @return int
   *   The identifier of the latest published revision of the entity, or NULL
   *   if the entity does not have a published revision.
   */
  public function getLatestPublishedRevisionOrLatestId($ignore = NULL);

  /**
   * Get a Config Entity instance from Content Entity Revision.
   *
   * @param \Drupal\config_entity_revisions\Entity\ConfigEntityRevisions $content_entity
   *   The ConfigEntityRevisions entity instance.
   *
   * @return \Drupal\config_entity_revisions\Entity\ConfigEntityRevisions
   *   The deserialised config entity.
   */
  public function getConfigEntity(ConfigEntityRevisions $content_entity);

  /**
   * Create an initial revision record.
   *
   * @param \Drupal\config_entity_revisions\ConfigEntityRevisionsConfigEntityInterface $config_entity
   *   The configuration entity.
   *
   * @return \Drupal\Core\Entity\ContentEntityInterface|null
   *   The content entity created.
   *
   * @throws \Drupal\Core\Entity\EntityStorageException
   */
  public function createInitialRevision(ConfigEntityRevisionsConfigEntityInterface $config_entity);

  /**
   * Create revision when a new config entity version is saved.
   *
   * @param \Drupal\config_entity_revisions\ConfigEntityRevisionsConfigEntityInterface $config_entity
   *   The configuration entity.
   *
   * @throws \Drupal\Core\Entity\EntityStorageException
   */
  public function createUpdateRevision(ConfigEntityRevisionsConfigEntityInterface $config_entity);

  /**
   * Make default the most recently published or the most recent revision.
   *
   * This is needed because content_moderation has a concept of a default
   * revision, which this module doesn't really care about, but which will
   * cause problems if we attempt to delete a revision that's marked as the
   * default.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface $content_entity
   *   The content (revisions) entity.
   */
  public function resetDefaultRevision(ContentEntityInterface $content_entity);

  /**
   * Get a list of revision IDs for a content entity.
   */
  public function getRevisionIds($content_entity_id);

  /**
   * Delete a single revision.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface $revision
   *   The revision to be deleted.
   */
  public function deleteSingleRevision(ContentEntityInterface $revision);

  /**
   * Delete revisions when a config entity is deleted.
   *
   * @param \Drupal\config_entity_revisions\ConfigEntityRevisionsConfigEntityInterface $config_entity
   *   The configuration entity being deleted.
   */
  public function deleteRevisions(ConfigEntityRevisionsConfigEntityInterface $config_entity);

  /**
   * Load a particular revision of a config entity.
   *
   * @param int $revision
   *   The revision ID to load.
   * @param mixed $entity
   *   The entity type to load.
   *
   * @return mixed
   *   The loaded revision or NULL.
   */
  public function loadConfigEntityRevision($revision = NULL, $entity = '');

}

Interfaces

Namesort descending Description
ConfigEntityRevisionsRevisionStorageHandlerInterface Interface ConfigEntityRevisionsRevisionStorageHandlerInterface.