4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Validator;
15 * Validates values and graphs of objects and arrays.
17 * @author Bernhard Schussek <bschussek@gmail.com>
19 * @deprecated since version 2.5, to be removed in 3.0.
20 * Use {@link \Symfony\Component\Validator\Validator\ValidatorInterface} instead.
22 interface ValidatorInterface
27 * The accepted values depend on the {@link MetadataFactoryInterface}
30 * The signature changed with Symfony 2.5 (see
31 * {@link Validator\ValidatorInterface::validate()}. This signature will be
32 * disabled in Symfony 3.0.
34 * @param mixed $value The value to validate
35 * @param array|null $groups The validation groups to validate
36 * @param bool $traverse Whether to traverse the value if it is traversable
37 * @param bool $deep Whether to traverse nested traversable values recursively
39 * @return ConstraintViolationListInterface A list of constraint violations. If the
40 * list is empty, validation succeeded.
42 public function validate($value, $groups = null, $traverse = false, $deep = false);
45 * Validates a property of a value against its current value.
47 * The accepted values depend on the {@link MetadataFactoryInterface}
50 * @param mixed $containingValue The value containing the property
51 * @param string $property The name of the property to validate
52 * @param array|null $groups The validation groups to validate
54 * @return ConstraintViolationListInterface A list of constraint violations. If the
55 * list is empty, validation succeeded.
57 public function validateProperty($containingValue, $property, $groups = null);
60 * Validate a property of a value against a potential value.
62 * The accepted values depend on the {@link MetadataFactoryInterface}
65 * @param mixed $containingValue The value containing the property
66 * @param string $property The name of the property to validate
67 * @param string $value The value to validate against the
68 * constraints of the property.
69 * @param array|null $groups The validation groups to validate
71 * @return ConstraintViolationListInterface A list of constraint violations. If the
72 * list is empty, validation succeeded.
74 public function validatePropertyValue($containingValue, $property, $value, $groups = null);
77 * Validates a value against a constraint or a list of constraints.
79 * @param mixed $value The value to validate
80 * @param Constraint|Constraint[] $constraints The constraint(s) to validate against
81 * @param array|null $groups The validation groups to validate
83 * @return ConstraintViolationListInterface A list of constraint violations. If the
84 * list is empty, validation succeeded.
86 * @deprecated since version 2.5, to be removed in 3.0.
87 * Renamed to {@link Validator\ValidatorInterface::validate()}
90 public function validateValue($value, $constraints, $groups = null);
93 * Returns the factory for metadata instances.
95 * @return MetadataFactoryInterface The metadata factory
97 * @deprecated since version 2.5, to be removed in 3.0.
98 * Use {@link Validator\ValidatorInterface::getMetadataFor()} or
99 * {@link Validator\ValidatorInterface::hasMetadataFor()}
102 public function getMetadataFactory();