updateOriginalValues example


  abstract protected function doSaveFieldItems(ContentEntityInterface $entity, array $names = []);

  /** * {@inheritdoc} */
  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();

    if ($entity->getEntityType()->isRevisionable() && !$entity->isNew() && empty($entity->getLoadedRevisionId())) {
      // Update the loaded revision id for rare special cases when no loaded       // revision is given when updating an existing entity. This for example       // happens when calling save() in hook_entity_insert().       $entity->updateLoadedRevisionId();
    }

    $id = parent::doPreSave($entity);

    if (!$entity->isNew()) {
      
Home | Imprint | This part of the site doesn't use cookies.