function EntityStorageBase::doCreate

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::doCreate()
  2. 8.9.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::doCreate()
  3. 11.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::doCreate()

Performs storage-specific creation of entities.

Parameters

array $values: An array of values to set, keyed by property name.

Return value

\Drupal\Core\Entity\EntityInterface

1 call to EntityStorageBase::doCreate()
EntityStorageBase::create in core/lib/Drupal/Core/Entity/EntityStorageBase.php
Constructs a new entity object, without permanently saving it.
3 methods override EntityStorageBase::doCreate()
ConfigEntityStorage::doCreate in core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
Performs storage-specific creation of entities.
ContentEntityStorageBase::doCreate in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Performs storage-specific creation of entities.
KeyValueEntityStorage::doCreate in core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php
Performs storage-specific creation of entities.

File

core/lib/Drupal/Core/Entity/EntityStorageBase.php, line 252

Class

EntityStorageBase
A base entity storage class.

Namespace

Drupal\Core\Entity

Code

protected function doCreate(array $values) {
    $entity_class = $this->getEntityClass();
    return new $entity_class($values, $this->entityTypeId);
}

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