You are here

trait EntityNeedsSaveTrait in Entity Reference Revisions 8

Trait for EntityNeedsSaveInterface.

Hierarchy

1 file declares its use of EntityNeedsSaveTrait
EntityTestCompositeRelationship.php in tests/modules/entity_composite_relationship_test/src/Entity/EntityTestCompositeRelationship.php

File

src/EntityNeedsSaveTrait.php, line 9

Namespace

Drupal\entity_reference_revisions
View source
trait EntityNeedsSaveTrait {

  /**
   * Whether the entity needs to be saved or not.
   *
   * @var bool
   */
  protected $needsSave = FALSE;

  /**
   * {@inheritdoc}
   */
  public function needsSave() {
    return $this->needsSave;
  }

  /**
   * {@inheritdoc}
   */
  public function setNeedsSave($needs_save) {
    $this->needsSave = $needs_save;
  }

  /**
   * {@inheritdoc}
   */
  public function postSave(EntityStorageInterface $storage, $update = TRUE) {
    parent::postSave($storage, $update);
    $this
      ->setNeedsSave(FALSE);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityNeedsSaveTrait::$needsSave protected property Whether the entity needs to be saved or not.
EntityNeedsSaveTrait::needsSave public function
EntityNeedsSaveTrait::postSave public function
EntityNeedsSaveTrait::setNeedsSave public function