8.2.x Entity.php public Entity::__construct(array $values, $entity_type)
8.2.x Entity.php public Entity::__construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles)
8.2.x Entity.php public Entity::__construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager)
8.2.x Entity.php public Entity::__construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager)
8.0.x Entity.php public Entity::__construct(array $values, $entity_type)
8.0.x Entity.php public Entity::__construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles)
8.0.x Entity.php public Entity::__construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager)
8.0.x Entity.php public Entity::__construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager)
8.1.x Entity.php public Entity::__construct(array $values, $entity_type)
8.1.x Entity.php public Entity::__construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles)
8.1.x Entity.php public Entity::__construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager)
8.1.x Entity.php public Entity::__construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager)
8.3.x Entity.php public Entity::__construct(array $values, $entity_type)
8.3.x Entity.php public Entity::__construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles)
8.3.x Entity.php public Entity::__construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager)
8.3.x Entity.php public Entity::__construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager)

Constructs an Entity object.

Parameters

array $values: An array of values to set, keyed by property name. If the entity type has bundles, the bundle key has to be specified.

string $entity_type: The type of the entity to create.

1 call to Entity::__construct()
ConfigEntityBase::__construct in core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
Constructs an Entity object.
2 methods override Entity::__construct()
ConfigEntityBase::__construct in core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
Constructs an Entity object.
ContentEntityBase::__construct in core/lib/Drupal/Core/Entity/ContentEntityBase.php
Constructs an Entity object.

File

core/lib/Drupal/Core/Entity/Entity.php, line 58

Class

Entity
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

public function __construct(array $values, $entity_type) {
  $this->entityTypeId = $entity_type;
  // Set initial values.
  foreach ($values as $key => $value) {
    $this->$key = $value;
  }
}