You are here

public function User::isNew in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/Entity/User.php \Drupal\user\Entity\User::isNew()

Determines whether the entity is new.

Usually an entity is new if no ID exists for it yet. However, entities may be enforced to be new with existing IDs too.

Return value

bool TRUE if the entity is new, or FALSE if the entity has already been saved.

Overrides Entity::isNew

See also

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

File

core/modules/user/src/Entity/User.php, line 78
Contains \Drupal\user\Entity\User.

Class

User
Defines the user entity class.

Namespace

Drupal\user\Entity

Code

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