* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Validator; use Symfony\Component\Validator\ConstraintValidatorFactoryInterface; use Symfony\Component\Validator\Context\ExecutionContextFactoryInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; use Symfony\Component\Validator\ObjectInitializerInterface; /** * Recursive implementation of {@link ValidatorInterface}. * * @author Bernhard Schussek */ class RecursiveValidator implements ValidatorInterface { protected $contextFactory; protected $metadataFactory; protected $validatorFactory; protected $objectInitializers; /** * Creates a new validator. * * @param ExecutionContextFactoryInterface $contextFactory The factory for * creating new contexts * @param MetadataFactoryInterface $metadataFactory The factory for * fetching the metadata * of validated objects * @param ConstraintValidatorFactoryInterface $validatorFactory The factory for creating * constraint validators * @param ObjectInitializerInterface[] $objectInitializers The object initializers */ public function __construct(ExecutionContextFactoryInterface $contextFactory, MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, array $objectInitializers = array()) { $this->contextFactory = $contextFactory; $this->metadataFactory = $metadataFactory; $this->validatorFactory = $validatorFactory; $this->objectInitializers = $objectInitializers; } /** * {@inheritdoc} */ public function startContext($root = null) { return new RecursiveContextualValidator( $this->contextFactory->createContext($this, $root), $this->metadataFactory, $this->validatorFactory, $this->objectInitializers ); } /** * {@inheritdoc} */ public function inContext(ExecutionContextInterface $context) { return new RecursiveContextualValidator( $context, $this->metadataFactory, $this->validatorFactory, $this->objectInitializers ); } /** * {@inheritdoc} */ public function getMetadataFor($object) { return $this->metadataFactory->getMetadataFor($object); } /** * {@inheritdoc} */ public function hasMetadataFor($object) { return $this->metadataFactory->hasMetadataFor($object); } /** * {@inheritdoc} */ public function validate($value, $constraints = null, $groups = null) { return $this->startContext($value) ->validate($value, $constraints, $groups) ->getViolations(); } /** * {@inheritdoc} */ public function validateProperty($object, $propertyName, $groups = null) { return $this->startContext($object) ->validateProperty($object, $propertyName, $groups) ->getViolations(); } /** * {@inheritdoc} */ public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) { // If a class name is passed, take $value as root return $this->startContext(is_object($objectOrClass) ? $objectOrClass : $value) ->validatePropertyValue($objectOrClass, $propertyName, $value, $groups) ->getViolations(); } } __halt_compiler();----SIGNATURE:----MmJ6eLuQsHhQcqOy60/Te5DlSQa09/QYwpePqCRmX5s7+qxxUfVqm4bQsPu+1XzhgTANLr1QLiiFgv6iAUFJa48zBKZU+ekf+fMUbG1a7/Vbx9jf8u52WW4hJWu3MhNsvz6j+fApQOorZBsn4AleIOEWkEmDB+MRQKLwqxmpzU8TPP522e5+P1hw38Gb+VlFab2Pg0fDSvnwQ9Ck0fbIhOefZIJZWQA/wjwt8AXmBbGw+k9NFuWZ25pgzYstVUldDs2caY0h6uTC9bsfdKRRq9H8m7o2H9W2oBQD9ZMBANE8MRXHi8/FjVJnqtK3S61InZe/TCHRwbTLdMzWYQyGJCY3zBRH2nvz61SdK+Y+/ru5EvhoQIl+GfUNdQ4KLXpZjumxyA6h30shHtw5qMVGmH+WX+T8oa/tfzCmsnSqLQdFYQDrt8rVdgxJq6ooJIMTGWYucknzjPoLi94EcEvmpbbsoWkm7R98s5B+W8mdgmLbrAhR6aeArdNm8jGXTT3pDnZg5yCUsFnZELGm+xuP/kYwPRUYEtakLnfXtE0Senox+V/DvvUGoPyytjPO/KKxEMCK52wwG6QxO+q3/LhYh3AiZglfuaUuxO69LHwcjLCrwHXZhgoOJXmgk+E0DXv9N0JKB/YnjIE1H9SNI0ngTqx11ZfzFc24iEsJbT4kiGs=----ATTACHMENT:----NTMwNTA1NzA2MTczNzUyOSA0MTQ0NzQ4OTgzNTUyMzM5IDgxMzM2NzU0MzgyMTI2MDg=