function EntityFetchById::doExecute

Executes the action with the given context.

Parameters

string $type: The entity type id.

int $entity_id: The entity id.

File

src/Plugin/RulesAction/EntityFetchById.php, line 94

Class

EntityFetchById
Provides a 'Fetch entity by id' action.

Namespace

Drupal\rules\Plugin\RulesAction

Code

protected function doExecute($type, $entity_id) {
    $storage = $this->entityTypeManager
        ->getStorage($type);
    $entity = $storage->load($entity_id);
    $this->setProvidedValue('entity_fetched', $entity);
}