function EntityAdapter::toArray

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php \Drupal\Core\Entity\Plugin\DataType\EntityAdapter::toArray()
  2. 8.9.x core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php \Drupal\Core\Entity\Plugin\DataType\EntityAdapter::toArray()
  3. 11.x core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php \Drupal\Core\Entity\Plugin\DataType\EntityAdapter::toArray()

Overrides ComplexDataInterface::toArray

File

core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php, line 120

Class

EntityAdapter
Defines the "entity" data type.

Namespace

Drupal\Core\Entity\Plugin\DataType

Code

public function toArray() {
    if (!isset($this->entity)) {
        throw new MissingDataException('Unable to get property values as no entity has been provided.');
    }
    return $this->entity
        ->toArray();
}

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