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

Breadcrumb

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

function 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.

2 calls to EntityBase::__construct()
ConfigEntityBase::__construct in core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
Constructs an Entity object.
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\Entity

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal