Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::doPostSave()
  2. 9 core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::doPostSave()

Performs post save entity processing.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The saved entity.

bool $update: Specifies whether the entity is being updated or created.

2 calls to EntityStorageBase::doPostSave()
ContentEntityStorageBase::doPostSave in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Performs post save entity processing.
EntityStorageBase::save in core/lib/Drupal/Core/Entity/EntityStorageBase.php
Saves the entity permanently.
1 method overrides EntityStorageBase::doPostSave()
ContentEntityStorageBase::doPostSave in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Performs post save entity processing.

File

core/lib/Drupal/Core/Entity/EntityStorageBase.php, line 556

Class

EntityStorageBase
A base entity storage class.

Namespace

Drupal\Core\Entity

Code

protected function doPostSave(EntityInterface $entity, $update) {
  $this
    ->resetCache([
    $entity
      ->id(),
  ]);

  // The entity is no longer new.
  $entity
    ->enforceIsNew(FALSE);

  // Allow code to run after saving.
  $entity
    ->postSave($this, $update);
  $this
    ->invokeHook($update ? 'update' : 'insert', $entity);

  // After saving, this is now the "original entity", and subsequent saves
  // will be updates instead of inserts, and updates must always be able to
  // correctly identify the original entity.
  $entity
    ->setOriginalId($entity
    ->id());
  unset($entity->original);
}