function EntityBase::getOriginal

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::getOriginal()

Returns the original unchanged entity.

If the entity being saved was not the default revision then the original entity is that specific revision to allow for reliable comparisons.

This is only available while an entity is being saved.

Return value

static|null The original entity.

Overrides EntityInterface::getOriginal

11 calls to EntityBase::getOriginal()
BaseFieldOverride::preSave in core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php
BlockContent::preSaveRevision in core/modules/block_content/src/Entity/BlockContent.php
Acts on a revision before it gets saved.
ContentEntityBase::hasTranslationChanges in core/lib/Drupal/Core/Entity/ContentEntityBase.php
Determines if the current translation of the entity has unsaved changes.
FieldConfig::preSave in core/modules/field/src/Entity/FieldConfig.php
Overrides \Drupal\Core\Entity\EntityBase::preSave().
FieldStorageConfig::preSaveUpdated in core/modules/field/src/Entity/FieldStorageConfig.php
Prepares saving an updated field definition.

... See full list

File

core/lib/Drupal/Core/Entity/EntityBase.php, line 697

Class

EntityBase
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

public function getOriginal() : ?static {
  return $this->originalEntity;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.