You are here

interface ContextualValidatorInterface in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/validator/Validator/ContextualValidatorInterface.php \Symfony\Component\Validator\Validator\ContextualValidatorInterface
  2. 8 core/lib/Drupal/Core/TypedData/Validation/ContextualValidatorInterface.php \Drupal\Core\TypedData\Validation\ContextualValidatorInterface
Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Validator/ContextualValidatorInterface.php \Symfony\Component\Validator\Validator\ContextualValidatorInterface

A validator in a specific execution context.

@since 2.5

@author Bernhard Schussek <bschussek@gmail.com>

Hierarchy

Expanded class hierarchy of ContextualValidatorInterface

All classes that implement ContextualValidatorInterface

1 file declares its use of ContextualValidatorInterface
ContextualValidatorInterface.php in core/lib/Drupal/Core/TypedData/Validation/ContextualValidatorInterface.php
Contains \Drupal\Core\TypedData\Validation\ContextualValidatorInterface.

File

vendor/symfony/validator/Validator/ContextualValidatorInterface.php, line 24

Namespace

Symfony\Component\Validator\Validator
View source
interface ContextualValidatorInterface {

  /**
   * Appends the given path to the property path of the context.
   *
   * If called multiple times, the path will always be reset to the context's
   * original path with the given path appended to it.
   *
   * @param string $path The path to append
   *
   * @return ContextualValidatorInterface This validator
   */
  public function atPath($path);

  /**
   * Validates a value against a constraint or a list of constraints.
   *
   * If no constraint is passed, the constraint
   * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
   *
   * @param mixed                   $value       The value to validate
   * @param Constraint|Constraint[] $constraints The constraint(s) to validate
   *                                             against
   * @param array|null              $groups      The validation groups to
   *                                             validate. If none is given,
   *                                             "Default" is assumed
   *
   * @return ContextualValidatorInterface This validator
   */
  public function validate($value, $constraints = null, $groups = null);

  /**
   * Validates a property of an object against the constraints specified
   * for this property.
   *
   * @param object     $object       The object
   * @param string     $propertyName The name of the validated property
   * @param array|null $groups       The validation groups to validate. If
   *                                 none is given, "Default" is assumed
   *
   * @return ContextualValidatorInterface This validator
   */
  public function validateProperty($object, $propertyName, $groups = null);

  /**
   * Validates a value against the constraints specified for an object's
   * property.
   *
   * @param object|string $objectOrClass The object or its class name
   * @param string        $propertyName  The name of the property
   * @param mixed         $value         The value to validate against the
   *                                     property's constraints
   * @param array|null    $groups        The validation groups to validate. If
   *                                     none is given, "Default" is assumed
   *
   * @return ContextualValidatorInterface This validator
   */
  public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null);

  /**
   * Returns the violations that have been generated so far in the context
   * of the validator.
   *
   * @return ConstraintViolationListInterface The constraint violations
   */
  public function getViolations();

}

Members

Namesort descending Modifiers Type Description Overrides
ContextualValidatorInterface::atPath public function Appends the given path to the property path of the context. 2
ContextualValidatorInterface::getViolations public function Returns the violations that have been generated so far in the context of the validator. 2
ContextualValidatorInterface::validate public function Validates a value against a constraint or a list of constraints. 3
ContextualValidatorInterface::validateProperty public function Validates a property of an object against the constraints specified for this property. 2
ContextualValidatorInterface::validatePropertyValue public function Validates a value against the constraints specified for an object's property. 2