You are here

public function RuleExpression::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()

File

src/Plugin/RulesExpression/RuleExpression.php, line 243

Class

RuleExpression
Provides a rule, executing actions when conditions are met.

Namespace

Drupal\rules\Plugin\RulesExpression

Code

public function checkIntegrity(ExecutionMetadataStateInterface $metadata_state, $apply_assertions = TRUE) {
  $violation_list = $this->conditions
    ->checkIntegrity($metadata_state, $apply_assertions);
  $violation_list
    ->addAll($this->actions
    ->checkIntegrity($metadata_state, $apply_assertions));
  return $violation_list;
}