You are here

public function EntityBase::enforceIsNew in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::enforceIsNew()
  2. 10 core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::enforceIsNew()

Enforces an entity to be new.

Allows migrations to create entities with pre-defined IDs by forcing the entity to be new before saving.

Parameters

bool $value: (optional) Whether the entity should be forced to be new. Defaults to TRUE.

Return value

$this

Overrides EntityInterface::enforceIsNew

See also

\Drupal\Core\Entity\EntityInterface::isNew()

1 call to EntityBase::enforceIsNew()
EntityBase::setOriginalId in core/lib/Drupal/Core/Entity/EntityBase.php
Sets the original ID.

File

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

Class

EntityBase
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

public function enforceIsNew($value = TRUE) {
  $this->enforceIsNew = $value;
  return $this;
}