public function EntityInterface::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.

See also

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

3 methods override EntityInterface::enforceIsNew()
Entity::enforceIsNew in drupal/core/lib/Drupal/Core/Entity/Entity.php
Implements \Drupal\Core\Entity\EntityInterface::enforceIsNew().
EntityBCDecorator::enforceIsNew in drupal/core/lib/Drupal/Core/Entity/EntityBCDecorator.php
Forwards the call to the decorated entity.
ViewUI::enforceIsNew in drupal/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
Implements \Drupal\Core\Entity\EntityInterface::enforceIsNew().

File

drupal/core/lib/Drupal/Core/Entity/EntityInterface.php, line 97
Contains \Drupal\Core\Entity\EntityInterface.

Class

EntityInterface
Defines a common interface for all entity objects.

Namespace

Drupal\Core\Entity

Code

public function enforceIsNew($value = TRUE);