You are here

interface ConstraintViolationBuilderInterface in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Violation/ConstraintViolationBuilderInterface.php \Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface

Builds {@link \Symfony\Component\Validator\ConstraintViolationInterface} objects.

Use the various methods on this interface to configure the built violation. Finally, call {@link addViolation()} to add the violation to the current execution context.

@since 2.5

@author Bernhard Schussek <bschussek@gmail.com>

Hierarchy

Expanded class hierarchy of ConstraintViolationBuilderInterface

All classes that implement ConstraintViolationBuilderInterface

3 files declare their use of ConstraintViolationBuilderInterface
ConstraintValidator.php in vendor/symfony/validator/ConstraintValidator.php
ConstraintViolationBuilder.php in core/lib/Drupal/Core/TypedData/Validation/ConstraintViolationBuilder.php
Contains \Drupal\Core\TypedData\Validation\ConstraintViolationBuilder.
ExecutionContextInterface.php in vendor/symfony/validator/Context/ExecutionContextInterface.php

File

vendor/symfony/validator/Violation/ConstraintViolationBuilderInterface.php, line 26

Namespace

Symfony\Component\Validator\Violation
View source
interface ConstraintViolationBuilderInterface {

  /**
   * Stores the property path at which the violation should be generated.
   *
   * The passed path will be appended to the current property path of the
   * execution context.
   *
   * @param string $path The property path
   *
   * @return ConstraintViolationBuilderInterface This builder
   */
  public function atPath($path);

  /**
   * Sets a parameter to be inserted into the violation message.
   *
   * @param string $key   The name of the parameter
   * @param string $value The value to be inserted in the parameter's place
   *
   * @return ConstraintViolationBuilderInterface This builder
   */
  public function setParameter($key, $value);

  /**
   * Sets all parameters to be inserted into the violation message.
   *
   * @param array $parameters An array with the parameter names as keys and
   *                          the values to be inserted in their place as
   *                          values
   *
   * @return ConstraintViolationBuilderInterface This builder
   */
  public function setParameters(array $parameters);

  /**
   * Sets the translation domain which should be used for translating the
   * violation message.
   *
   * @param string $translationDomain The translation domain
   *
   * @return ConstraintViolationBuilderInterface This builder
   *
   * @see \Symfony\Component\Translation\TranslatorInterface
   */
  public function setTranslationDomain($translationDomain);

  /**
   * Sets the invalid value that caused this violation.
   *
   * @param mixed $invalidValue The invalid value
   *
   * @return ConstraintViolationBuilderInterface This builder
   */
  public function setInvalidValue($invalidValue);

  /**
   * Sets the number which determines how the plural form of the violation
   * message is chosen when it is translated.
   *
   * @param int $number The number for determining the plural form
   *
   * @return ConstraintViolationBuilderInterface This builder
   *
   * @see \Symfony\Component\Translation\TranslatorInterface::transChoice()
   */
  public function setPlural($number);

  /**
   * Sets the violation code.
   *
   * @param int $code The violation code
   *
   * @return ConstraintViolationBuilderInterface This builder
   */
  public function setCode($code);

  /**
   * Sets the cause of the violation.
   *
   * @param mixed $cause The cause of the violation
   *
   * @return ConstraintViolationBuilderInterface This builder
   */
  public function setCause($cause);

  /**
   * Adds the violation to the current execution context.
   */
  public function addViolation();

}

Members

Namesort descending Modifiers Type Description Overrides
ConstraintViolationBuilderInterface::addViolation public function Adds the violation to the current execution context. 3
ConstraintViolationBuilderInterface::atPath public function Stores the property path at which the violation should be generated. 3
ConstraintViolationBuilderInterface::setCause public function Sets the cause of the violation. 3
ConstraintViolationBuilderInterface::setCode public function Sets the violation code. 3
ConstraintViolationBuilderInterface::setInvalidValue public function Sets the invalid value that caused this violation. 3
ConstraintViolationBuilderInterface::setParameter public function Sets a parameter to be inserted into the violation message. 3
ConstraintViolationBuilderInterface::setParameters public function Sets all parameters to be inserted into the violation message. 3
ConstraintViolationBuilderInterface::setPlural public function Sets the number which determines how the plural form of the violation message is chosen when it is translated. 3
ConstraintViolationBuilderInterface::setTranslationDomain public function Sets the translation domain which should be used for translating the violation message. 3