You are here

interface ValidatorInterface in Plug 7

Same name in this branch
  1. 7 lib/Symfony/validator/Symfony/Component/Validator/ValidatorInterface.php \Symfony\Component\Validator\ValidatorInterface
  2. 7 lib/Symfony/validator/Symfony/Component/Validator/Validator/ValidatorInterface.php \Symfony\Component\Validator\Validator\ValidatorInterface

Validates PHP values against constraints.

@since 2.5 @author Bernhard Schussek <bschussek@gmail.com>

Hierarchy

Expanded class hierarchy of ValidatorInterface

All classes that implement ValidatorInterface

7 files declare their use of ValidatorInterface
Abstract2Dot5ApiTest.php in lib/Symfony/validator/Symfony/Component/Validator/Tests/Validator/Abstract2Dot5ApiTest.php
ExecutionContext.php in lib/Symfony/validator/Symfony/Component/Validator/Context/ExecutionContext.php
ExecutionContextFactory.php in lib/Symfony/validator/Symfony/Component/Validator/Context/ExecutionContextFactory.php
ExecutionContextFactoryInterface.php in lib/Symfony/validator/Symfony/Component/Validator/Context/ExecutionContextFactoryInterface.php
ExecutionContextInterface.php in lib/Symfony/validator/Symfony/Component/Validator/Context/ExecutionContextInterface.php

... See full list

File

lib/Symfony/validator/Symfony/Component/Validator/Validator/ValidatorInterface.php, line 25

Namespace

Symfony\Component\Validator\Validator
View source
interface ValidatorInterface extends MetadataFactoryInterface {

  /**
   * 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 ConstraintViolationListInterface A list of constraint violations.
   *                                          If the list is empty, validation
   *                                          succeeded
   */
  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 ConstraintViolationListInterface A list of constraint violations.
   *                                          If the list is empty, validation
   *                                          succeeded
   */
  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 ConstraintViolationListInterface A list of constraint violations.
   *                                          If the list is empty, validation
   *                                          succeeded
   */
  public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null);

  /**
   * Starts a new validation context and returns a validator for that context.
   *
   * The returned validator collects all violations generated within its
   * context. You can access these violations with the
   * {@link ContextualValidatorInterface::getViolations()} method.
   *
   * @return ContextualValidatorInterface The validator for the new context
   */
  public function startContext();

  /**
   * Returns a validator in the given execution context.
   *
   * The returned validator adds all generated violations to the given
   * context.
   *
   * @param ExecutionContextInterface $context The execution context
   *
   * @return ContextualValidatorInterface The validator for that context
   */
  public function inContext(ExecutionContextInterface $context);

}

Members

Namesort descending Modifiers Type Description Overrides
MetadataFactoryInterface::getMetadataFor public function Returns the metadata for the given value. 4
MetadataFactoryInterface::hasMetadataFor public function Returns whether the class is able to return metadata for the given value. 4
ValidatorInterface::inContext public function Returns a validator in the given execution context. 1
ValidatorInterface::startContext public function Starts a new validation context and returns a validator for that context. 1
ValidatorInterface::validate public function Validates a value against a constraint or a list of constraints.
ValidatorInterface::validateProperty public function Validates a property of an object against the constraints specified for this property.
ValidatorInterface::validatePropertyValue public function Validates a value against the constraints specified for an object's property.