You are here

trait RevisioningWorkaroundTrait in Apigee Edge 8

Some Drupal core & contrib modules assume all entities are revisionable.

Because all entities are either a content or a contrib entity. Well, this is not true. The Apigee Edge entities are the perfect counterexamples for this.

This trait contains some workarounds to make all components happy until this incorrect assumption hasn't been removed from core and contrib modules.

@internal

Hierarchy

See also

\Drupal\Core\Entity\RevisionableInterface

https://www.drupal.org/project/drupal/issues/2942529

https://www.drupal.org/project/drupal/issues/2951487

https://www.drupal.org/project/drupal/issues/3045384

File

src/Entity/RevisioningWorkaroundTrait.php, line 41

Namespace

Drupal\apigee_edge\Entity
View source
trait RevisioningWorkaroundTrait {

  /**
   * {@inheritdoc}
   */
  public function isNewRevision() {
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function setNewRevision($value = TRUE) {
    throw new \LogicException('Entity does not support revisions');
  }

  /**
   * {@inheritdoc}
   */
  public function getRevisionId() {
    return NULL;
  }

  /**
   * {@inheritdoc}
   */
  public function getLoadedRevisionId() {
    return NULL;
  }

  /**
   * {@inheritdoc}
   */
  public function updateLoadedRevisionId() {
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function isDefaultRevision($new_value = NULL) {
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function wasDefaultRevision() {
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function isLatestRevision() {
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record) {
  }

}

Members