You are here

protected function MultipleValuesGenerator::getEntity in Computed Field 3.x

Fetches the entity currently in use by the service.

Return value

\Drupal\Core\Entity\EntityInterface|null The entity currently in use by the service.

Throws

\Exception If the entity is missing.

1 call to MultipleValuesGenerator::getEntity()
MultipleValuesGenerator::generateMissingValues in src/MultipleValuesGenerator.php
Generates missing computed-field values in multi-valued computed fields.

File

src/MultipleValuesGenerator.php, line 87

Class

MultipleValuesGenerator
Service for generating missing values for multi-valued computed fields.

Namespace

Drupal\computed_field

Code

protected function getEntity() {
  if (is_null($this->entity)) {
    throw new \Exception('This operation requires that the service be set with an entity.');
  }
  return $this->entity;
}