8.3.x Entity.php public Entity::getTypedData()
8.0.x Entity.php public Entity::getTypedData()
8.1.x Entity.php public Entity::getTypedData()
8.2.x Entity.php public Entity::getTypedData()
8.4.x Entity.php public Entity::getTypedData()

Gets a typed data object for this entity object.

The returned typed data object wraps this entity and allows dealing with entities based on the generic typed data API.

Return value

\Drupal\Core\TypedData\ComplexDataInterface The typed data object for this entity.

Overrides EntityInterface::getTypedData

See also

\Drupal\Core\TypedData\TypedDataInterface

1 call to Entity::getTypedData()
ContentEntityBase::validate in core/lib/Drupal/Core/Entity/ContentEntityBase.php
Validates the currently set values.

File

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

Class

Entity
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

public function getTypedData() {
  if (!isset($this->typedData)) {
    $class = \Drupal::typedDataManager()->getDefinition('entity') ['class'];
    $this->typedData = $class::createFromEntity($this);
  }
  return $this->typedData;
}