function EntityBase::isNew

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::isNew()
  2. 10 core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::isNew()
  3. 11.x core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::isNew()

Overrides EntityInterface::isNew

9 calls to EntityBase::isNew()
Comment::preSave in core/modules/comment/src/Entity/Comment.php
Acts on an entity before the presave hook is invoked.
ContentEntityBase::hasTranslationChanges in core/lib/Drupal/Core/Entity/ContentEntityBase.php
ContentEntityBase::isDefaultRevision in core/lib/Drupal/Core/Entity/ContentEntityBase.php
ContentEntityBase::onChange in core/lib/Drupal/Core/Entity/ContentEntityBase.php
ContentEntityBase::wasDefaultRevision in core/lib/Drupal/Core/Entity/ContentEntityBase.php

... See full list

2 methods override EntityBase::isNew()
ConfigEntityBase::isNew in core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
Overrides Entity::isNew().
User::isNew in core/modules/user/src/Entity/User.php
Determines whether the entity is new.

File

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

Class

EntityBase
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

public function isNew() {
    return !empty($this->enforceIsNew) || !$this->id();
}

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