W3cubDocs

/Drupal 8

protected function EntityStorageBase::doPostSave

protected EntityStorageBase::doPostSave(EntityInterface $entity, $update)

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.

File

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

Class

EntityStorageBase
A base entity storage class.

Namespace

Drupal\Core\Entity

Code

protected function doPostSave(EntityInterface $entity, $update) {
  $this->resetCache(array($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);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityStorageBase.php/function/EntityStorageBase::doPostSave/8.1.x