You are here

interface ExecutionStateInterface in Rules 8.3

Defines an interface for the execution context state.

Hierarchy

Expanded class hierarchy of ExecutionStateInterface

All classes that implement ExecutionStateInterface

20 files declare their use of ExecutionStateInterface
ActionExpression.php in src/Plugin/RulesExpression/ActionExpression.php
ActionSetExpression.php in src/Plugin/RulesExpression/ActionSetExpression.php
ActionSetExpressionTest.php in tests/src/Unit/ActionSetExpressionTest.php
AndExpression.php in src/Plugin/RulesExpression/AndExpression.php
AndExpressionTest.php in tests/src/Unit/AndExpressionTest.php

... See full list

File

src/Context/ExecutionStateInterface.php, line 10

Namespace

Drupal\rules\Context
View source
interface ExecutionStateInterface {

  /**
   * Sets a state variable based on its definition and value.
   *
   * @param string $name
   *   The context variable name.
   * @param \Drupal\rules\Context\ContextDefinitionInterface $definition
   *   The context definition of the variable.
   * @param mixed $value
   *   The variable value.
   *
   * @return $this
   */
  public function setVariable($name, ContextDefinitionInterface $definition, $value);

  /**
   * Sets a state variable with some typed data object.
   *
   * @param string $name
   *   The variable name.
   * @param \Drupal\Core\TypedData\TypedDataInterface $data
   *   The variable wrapped as typed data.
   *
   * @return $this
   */
  public function setVariableData($name, TypedDataInterface $data);

  /**
   * Gets a variable.
   *
   * @param string $name
   *   The name of the variable to return.
   *
   * @return \Drupal\Core\TypedData\TypedDataInterface
   *   The variable wrapped as typed data.
   *
   * @throws \Drupal\rules\Exception\EvaluationException
   *   Throws an EvaluationException if the variable does not exist in the
   *   state.
   */
  public function getVariable($name);

  /**
   * Gets the value of a variable.
   *
   * @param string $name
   *   The name of the variable to return the value for.
   *
   * @return mixed
   *   The variable value.
   *
   * @throws \Drupal\rules\Exception\EvaluationException
   *   Throws an EvaluationException if the variable does not exist in the
   *   state.
   */
  public function getVariableValue($name);

  /**
   * Checks if a variable exists by name in the execution state.
   *
   * @param string $name
   *   The variable name.
   *
   * @return bool
   *   TRUE if the variable exists, FALSE otherwise.
   */
  public function hasVariable($name);

  /**
   * Removes a variable from the state if it is set.
   *
   * @param string $name
   *   The name of the variable to remove.
   *
   * @return $this
   */
  public function removeVariable($name);

  /**
   * Returns a value as specified in the selector.
   *
   * @param string $property_path
   *   The property path string starting with a variable name; e.g.,
   *   "node.uid.entity.mail.value".
   * @param string $langcode
   *   (optional) The language code used to get the argument value if the
   *   argument value should be translated. Defaults to NULL.
   *
   * @return \Drupal\Core\TypedData\TypedDataInterface
   *   The variable wrapped as typed data.
   *
   * @throws \Drupal\rules\Exception\EvaluationException
   *   Throws an EvaluationException in case the selector cannot be applied.
   */
  public function fetchDataByPropertyPath($property_path, $langcode = NULL);

  /**
   * Mark a variable to be saved later when the execution is finished.
   *
   * @param string $selector
   *   The data selector that specifies the target object to be saved. Example:
   *   node.uid.entity.
   *
   * @return $this
   */
  public function saveChangesLater($selector);

  /**
   * Returns the list of variables that should be auto-saved after execution.
   *
   * @return string[]
   *   The list of data selectors that specify the target object to be saved.
   *   Example: node.uid.entity.
   */
  public function getAutoSaveSelectors();

  /**
   * Saves all variables that have been marked for auto saving.
   *
   * @return $this
   */
  public function autoSave();

}

Members

Namesort descending Modifiers Type Description Overrides
ExecutionStateInterface::autoSave public function Saves all variables that have been marked for auto saving. 1
ExecutionStateInterface::fetchDataByPropertyPath public function Returns a value as specified in the selector. 1
ExecutionStateInterface::getAutoSaveSelectors public function Returns the list of variables that should be auto-saved after execution. 1
ExecutionStateInterface::getVariable public function Gets a variable. 1
ExecutionStateInterface::getVariableValue public function Gets the value of a variable. 1
ExecutionStateInterface::hasVariable public function Checks if a variable exists by name in the execution state. 1
ExecutionStateInterface::removeVariable public function Removes a variable from the state if it is set. 1
ExecutionStateInterface::saveChangesLater public function Mark a variable to be saved later when the execution is finished. 1
ExecutionStateInterface::setVariable public function Sets a state variable based on its definition and value. 1
ExecutionStateInterface::setVariableData public function Sets a state variable with some typed data object. 1