You are here

public function ExpressionContainerBase::checkIntegrity in Rules 8.3

Verifies that this expression is configured correctly.

Example: All configured data selectors must be valid.

Note that for checking integrity the execution metadata state must be passed prepared as achieved by ::prepareExecutionMetadataState() and the expression must apply all metadata state preparations during its integrity check as it does in ::prepareExecutionMetadataState(). This allows for efficient integrity checks of expression trees; e.g. see \Drupal\rules\Engine\ActionExpressionContainer::checkIntegrity().

Parameters

\Drupal\rules\Context\ExecutionMetadataStateInterface $metadata_state: The execution metadata state, prepared until right before this expression.

bool $apply_assertions: (optional) Whether to apply metadata assertions while preparing the execution metadata state. Defaults to TRUE.

Return value

\Drupal\rules\Engine\IntegrityViolationList A list object containing \Drupal\rules\Engine\IntegrityViolation objects.

Overrides ExpressionInterface::checkIntegrity

See also

::prepareExecutionMetadataState()

1 call to ExpressionContainerBase::checkIntegrity()
LoopExpression::checkIntegrity in src/Plugin/RulesExpression/LoopExpression.php
Verifies that this expression is configured correctly.
1 method overrides ExpressionContainerBase::checkIntegrity()
LoopExpression::checkIntegrity in src/Plugin/RulesExpression/LoopExpression.php
Verifies that this expression is configured correctly.

File

src/Engine/ExpressionContainerBase.php, line 86

Class

ExpressionContainerBase
Common base class for action and condition expression containers.

Namespace

Drupal\rules\Engine

Code

public function checkIntegrity(ExecutionMetadataStateInterface $metadata_state, $apply_assertions = TRUE) {
  $violation_list = new IntegrityViolationList();
  $this
    ->prepareExecutionMetadataStateBeforeTraversal($metadata_state);
  $apply_assertions = $apply_assertions && $this
    ->allowsMetadataAssertions();
  foreach ($this as $child_expression) {
    $child_violations = $child_expression
      ->checkIntegrity($metadata_state, $apply_assertions);
    $violation_list
      ->addAll($child_violations);
  }
  $this
    ->prepareExecutionMetadataStateAfterTraversal($metadata_state);
  return $violation_list;
}