public function EntityAdapter::toArray in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php \Drupal\Core\Entity\Plugin\DataType\EntityAdapter::toArray()
Returns an array of all property values.
Gets an array of plain property values including all not-computed properties.
Return value
array An array of property values, keyed by property name.
Throws
\Drupal\Core\TypedData\Exception\MissingDataException If the complex data structure is unset and no property can be created.
Overrides ComplexDataInterface::toArray
File
- core/
lib/ Drupal/ Core/ Entity/ Plugin/ DataType/ EntityAdapter.php, line 118
Class
- EntityAdapter
- Defines the "entity" data type.
Namespace
Drupal\Core\Entity\Plugin\DataTypeCode
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();
}