function EntityBase::__construct
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::__construct()
- 8.9.x core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::__construct()
- 10 core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::__construct()
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 EntityBase::__construct()
- ConfigEntityBase::__construct in core/
lib/ Drupal/ Core/ Config/ Entity/ ConfigEntityBase.php - Constructs an Entity object.
2 methods override EntityBase::__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/ EntityBase.php, line 59
Class
- EntityBase
- Defines a base entity class.
Namespace
Drupal\Core\EntityCode
public function __construct(array $values, $entity_type) {
$this->entityTypeId = $entity_type;
// Set initial values.
foreach ($values as $key => $value) {
$this->{$key} = $value;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.