public function ConfigStorageController::create

Implements Drupal\Core\Entity\EntityStorageControllerInterface::create().

Overrides EntityStorageControllerInterface::create

1 call to ConfigStorageController::create()
ViewStorageController::create in drupal/core/modules/views/lib/Drupal/views/ViewStorageController.php
Overrides Drupal\config\ConfigStorageController::create().
1 method overrides ConfigStorageController::create()
ViewStorageController::create in drupal/core/modules/views/lib/Drupal/views/ViewStorageController.php
Overrides Drupal\config\ConfigStorageController::create().

File

drupal/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php, line 222
Definition of Drupal\Core\Config\Entity\ConfigStorageController.

Class

ConfigStorageController
Defines the storage controller class for configuration entities.

Namespace

Drupal\Core\Config\Entity

Code

public function create(array $values) {
  $class = $this->entityInfo['class'];
  $entity = new $class($values, $this->entityType);

  // Mark this entity as new, so isNew() returns TRUE. This does not check
  // whether a configuration entity with the same ID (if any) already exists.
  $entity
    ->enforceIsNew();

  // Assign a new UUID if there is none yet.
  if (!isset($entity->{$this->uuidKey})) {
    $uuid = new Uuid();
    $entity->{$this->uuidKey} = $uuid
      ->generate();
  }
  return $entity;
}