You are here

interface IntegrityViolationInterface in Rules 8.3

Describes a violation of the integrity of a rule.

Example: if the data selector node.field_example is used in an action but there is no "node" variable available in the context of the rule then a violation is raised during the integrity check of the rule.

Hierarchy

Expanded class hierarchy of IntegrityViolationInterface

All classes that implement IntegrityViolationInterface

File

src/Engine/IntegrityViolationInterface.php, line 14

Namespace

Drupal\rules\Engine
View source
interface IntegrityViolationInterface {

  /**
   * Sets the user facing message that can be displayed for this violation.
   *
   * @param \Drupal\Core\StringTranslation\TranslatableMarkup $message
   *   The message.
   *
   * @return $this
   */
  public function setMessage(TranslatableMarkup $message);

  /**
   * Returns the translated message of this violation.
   *
   * @return \Drupal\Core\StringTranslation\TranslatableMarkup
   *   The message.
   */
  public function getMessage();

  /**
   * Sets the context name when this violation should be associated to one.
   *
   * @param string $context_name
   *   The context name.
   *
   * @return $this
   */
  public function setContextName($context_name);

  /**
   * Returns the associated context name, if there is one.
   *
   * A violation can relate to a specific context that is used in the
   * expression.
   *
   * @return string|null
   *   The context name or NULL if the violation is not specific to a context.
   */
  public function getContextName();

  /**
   * Sets the UUID of the nested expression where this violation occurred.
   *
   * @param string $uuid
   *   The UUID.
   *
   * @return $this
   */
  public function setUuid($uuid);

  /**
   * Returns the UUID of the expression this violation belongs to.
   *
   * @return string
   *   The UUID.
   */
  public function getUuid();

}

Members

Namesort descending Modifiers Type Description Overrides
IntegrityViolationInterface::getContextName public function Returns the associated context name, if there is one. 1
IntegrityViolationInterface::getMessage public function Returns the translated message of this violation. 1
IntegrityViolationInterface::getUuid public function Returns the UUID of the expression this violation belongs to. 1
IntegrityViolationInterface::setContextName public function Sets the context name when this violation should be associated to one. 1
IntegrityViolationInterface::setMessage public function Sets the user facing message that can be displayed for this violation. 1
IntegrityViolationInterface::setUuid public function Sets the UUID of the nested expression where this violation occurred. 1