ab1e9f3f81
* 2.3: Configure firewall's kernel exception listener with configured entry point or a default entry point PSR-2 fixes [DependencyInjection] make paths relative to __DIR__ in the generated container Fixed the syntax of a composer.json file Fixed the symfony/config version constraint Tweaked the password-compat version constraint Docblock fixes define constant only if it wasn't defined before Fix incorrect spanish translation Fixed typos Conflicts: composer.json src/Symfony/Bridge/Twig/TwigEngine.php src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php src/Symfony/Bundle/FrameworkBundle/Templating/Loader/FilesystemLoader.php src/Symfony/Bundle/FrameworkBundle/composer.json src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php src/Symfony/Component/Console/Helper/TableHelper.php src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php src/Symfony/Component/Debug/ErrorHandler.php src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php src/Symfony/Component/HttpFoundation/Response.php src/Symfony/Component/HttpFoundation/StreamedResponse.php src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php src/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php src/Symfony/Component/HttpKernel/Fragment/RoutableFragmentRenderer.php src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php src/Symfony/Component/Process/Process.php src/Symfony/Component/Process/Tests/AbstractProcessTest.php src/Symfony/Component/PropertyAccess/PropertyAccessorBuilder.php src/Symfony/Component/Routing/Tests/Fixtures/validpattern.php src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php src/Symfony/Component/Security/composer.json src/Symfony/Component/Serializer/Encoder/XmlEncoder.php src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php src/Symfony/Component/Stopwatch/StopwatchEvent.php src/Symfony/Component/Stopwatch/StopwatchPeriod.php src/Symfony/Component/Templating/PhpEngine.php src/Symfony/Component/Templating/TemplateReference.php src/Symfony/Component/Templating/TemplateReferenceInterface.php src/Symfony/Component/Translation/TranslatorInterface.php src/Symfony/Component/Validator/ConstraintViolation.php src/Symfony/Component/Validator/ExecutionContextInterface.php src/Symfony/Component/Validator/Mapping/ClassMetadata.php src/Symfony/Component/Validator/MetadataFactoryInterface.php
87 lines
3.7 KiB
PHP
87 lines
3.7 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Symfony package.
|
|
*
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Symfony\Component\Validator;
|
|
|
|
/**
|
|
* Validates values against constraints defined in {@link MetadataInterface}
|
|
* instances.
|
|
*
|
|
* This interface is an implementation of the Visitor design pattern. A value
|
|
* is validated by first passing it to the {@link validate} method. That method
|
|
* will determine the matching {@link MetadataInterface} for validating the
|
|
* value. It then calls the {@link MetadataInterface::accept} method of that
|
|
* metadata. <tt>accept()</tt> does two things:
|
|
*
|
|
* <ol>
|
|
* <li>It calls {@link visit} to validate the value against the constraints of
|
|
* the metadata.</li>
|
|
* <li>It calls <tt>accept()</tt> on all nested metadata instances with the
|
|
* corresponding values extracted from the current value. For example, if the
|
|
* current metadata represents a class and the current value is an object of
|
|
* that class, the metadata contains nested instances for each property of that
|
|
* class. It forwards the call to these nested metadata with the values of the
|
|
* corresponding properties in the original object.</li>
|
|
* </ol>
|
|
*
|
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
|
*
|
|
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
|
|
*/
|
|
interface ValidationVisitorInterface
|
|
{
|
|
/**
|
|
* Validates a value.
|
|
*
|
|
* If the value is an array or a traversable object, you can set the
|
|
* parameter <tt>$traverse</tt> to <tt>true</tt> in order to run through
|
|
* the collection and validate each element. If these elements can be
|
|
* collections again and you want to traverse them recursively, set the
|
|
* parameter <tt>$deep</tt> to <tt>true</tt> as well.
|
|
*
|
|
* If you set <tt>$traversable</tt> to <tt>true</tt>, the visitor will
|
|
* nevertheless try to find metadata for the collection and validate its
|
|
* constraints. If no such metadata is found, the visitor ignores that and
|
|
* only iterates the collection.
|
|
*
|
|
* If you don't set <tt>$traversable</tt> to <tt>true</tt> and the visitor
|
|
* does not find metadata for the given value, it will fail with an
|
|
* exception.
|
|
*
|
|
* @param mixed $value The value to validate.
|
|
* @param string $group The validation group to validate.
|
|
* @param string $propertyPath The current property path in the validation graph.
|
|
* @param bool $traverse Whether to traverse the value if it is traversable.
|
|
* @param bool $deep Whether to traverse nested traversable values recursively.
|
|
*
|
|
* @throws Exception\NoSuchMetadataException If no metadata can be found for
|
|
* the given value.
|
|
*
|
|
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
|
|
*/
|
|
public function validate($value, $group, $propertyPath, $traverse = false, $deep = false);
|
|
|
|
/**
|
|
* Validates a value against the constraints defined in some metadata.
|
|
*
|
|
* This method implements the Visitor design pattern. See also
|
|
* {@link ValidationVisitorInterface}.
|
|
*
|
|
* @param MetadataInterface $metadata The metadata holding the constraints.
|
|
* @param mixed $value The value to validate.
|
|
* @param string $group The validation group to validate.
|
|
* @param string $propertyPath The current property path in the validation graph.
|
|
*
|
|
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
|
|
*/
|
|
public function visit(MetadataInterface $metadata, $value, $group, $propertyPath);
|
|
}
|