function LoopExpression::prepareExecutionMetadataStateBeforeTraversal

Prepares execution metadata state before traversing through children.

Overrides ExpressionContainerBase::prepareExecutionMetadataStateBeforeTraversal

File

src/Plugin/RulesExpression/LoopExpression.php, line 112

Class

LoopExpression
Holds a set of actions that are executed over the iteration of a list.

Namespace

Drupal\rules\Plugin\RulesExpression

Code

protected function prepareExecutionMetadataStateBeforeTraversal(ExecutionMetadataStateInterface $metadata_state) {
  try {
    $list_definition = $metadata_state->fetchDefinitionByPropertyPath($this->configuration['list']);
    $list_item_definition = $list_definition->getItemDefinition();
    $metadata_state->setDataDefinition($this->configuration['list_item'], $list_item_definition);
  } catch (IntegrityException $e) {
    // Silently eat the exception: we just continue without adding the list
    // item definition to the state.
  }
}