Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityBase.php

function EntityBase::create

Overrides EntityInterface::create

3 calls to EntityBase::create()
Action::create in core/modules/system/src/Entity/Action.php
Constructs a new entity object, without permanently saving it.
Action::create in core/modules/system/src/Entity/Action.php
Constructs a new entity object, without permanently saving it.
ConfigurableLanguage::createFromLangcode in core/modules/language/src/Entity/ConfigurableLanguage.php
Creates a configurable language object from a langcode.
2 methods override EntityBase::create()
Action::create in core/modules/system/src/Entity/Action.php
Constructs a new entity object, without permanently saving it.
ContentEntityBase::create in core/lib/Drupal/Core/Entity/ContentEntityBase.php
Constructs a new entity object, without permanently saving it.

File

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

Class

EntityBase
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

public static function create(array $values = []) {
    $entity_type_repository = \Drupal::service('entity_type.repository');
    $entity_type_manager = \Drupal::entityTypeManager();
    $storage = $entity_type_manager->getStorage($entity_type_repository->getEntityTypeFromClass(static::class));
    return $storage->create($values);
}
RSS feed
Powered by Drupal