You are here

protected function ContentEntityStorageBase::doPreSave in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::doPreSave()

Performs presave entity processing.

Parameters

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

Return value

int|string The processed entity identifier.

Throws

\Drupal\Core\Entity\EntityStorageException If the entity identifier is invalid.

Overrides EntityStorageBase::doPreSave

File

core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php, line 290
Contains \Drupal\Core\Entity\ContentEntityStorageBase.

Class

ContentEntityStorageBase
Base class for content entity storage handlers.

Namespace

Drupal\Core\Entity

Code

protected function doPreSave(EntityInterface $entity) {

  /** @var \Drupal\Core\Entity\ContentEntityBase $entity */

  // Sync the changes made in the fields array to the internal values array.
  $entity
    ->updateOriginalValues();
  return parent::doPreSave($entity);
}