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);
}
doc_Drupal
2016-10-29 09:07:39
Comments
Leave a Comment

Please login to continue.