You are here

public function Entity::__construct in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/validator/Tests/Fixtures/Entity.php \Symfony\Component\Validator\Tests\Fixtures\Entity::__construct()
  2. 8 core/lib/Drupal/Core/Entity/Entity.php \Drupal\Core\Entity\Entity::__construct()
  3. 8 core/modules/views/src/Plugin/views/area/Entity.php \Drupal\views\Plugin\views\area\Entity::__construct()
  4. 8 core/modules/views/src/Plugin/views/argument_validator/Entity.php \Drupal\views\Plugin\views\argument_validator\Entity::__construct()
  5. 8 core/modules/migrate/src/Plugin/migrate/destination/Entity.php \Drupal\migrate\Plugin\migrate\destination\Entity::__construct()
Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Entity/Entity.php \Drupal\Core\Entity\Entity::__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 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 63
Contains \Drupal\Core\Entity\Entity.

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;
  }
}