function EntityBase::getTypedData

Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::getTypedData()
  2. 10 core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::getTypedData()
  3. 11.x core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::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

File

core/lib/Drupal/Core/Entity/EntityBase.php, line 588

Class

EntityBase
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

public function getTypedData() {
    if (!isset($this->typedData)) {
        $class = $this->getTypedDataClass();
        $this->typedData = $class::createFromEntity($this);
    }
    return $this->typedData;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.