class RecursiveValidator in Plug 7
Recursive implementation of {@link ValidatorInterface}.
@since 2.5 @author Bernhard Schussek <bschussek@gmail.com>
Hierarchy
- class \Symfony\Component\Validator\Validator\RecursiveValidator implements ValidatorInterface
Expanded class hierarchy of RecursiveValidator
2 files declare their use of RecursiveValidator
- RecursiveValidator2Dot5ApiTest.php in lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Validator/ RecursiveValidator2Dot5ApiTest.php - ValidatorBuilder.php in lib/
Symfony/ validator/ Symfony/ Component/ Validator/ ValidatorBuilder.php
File
- lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Validator/ RecursiveValidator.php, line 26
Namespace
Symfony\Component\Validator\ValidatorView source
class RecursiveValidator implements ValidatorInterface {
/**
* @var ExecutionContextFactoryInterface
*/
protected $contextFactory;
/**
* @var MetadataFactoryInterface
*/
protected $metadataFactory;
/**
* @var ConstraintValidatorFactoryInterface
*/
protected $validatorFactory;
/**
* @var ObjectInitializerInterface[]
*/
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();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RecursiveValidator:: |
protected | property | ||
RecursiveValidator:: |
protected | property | ||
RecursiveValidator:: |
protected | property | ||
RecursiveValidator:: |
protected | property | ||
RecursiveValidator:: |
public | function |
Returns the metadata for the given value. Overrides MetadataFactoryInterface:: |
|
RecursiveValidator:: |
public | function |
Returns whether the class is able to return metadata for the given value. Overrides MetadataFactoryInterface:: |
|
RecursiveValidator:: |
public | function |
Returns a validator in the given execution context. Overrides ValidatorInterface:: |
|
RecursiveValidator:: |
public | function |
Starts a new validation context and returns a validator for that context. Overrides ValidatorInterface:: |
|
RecursiveValidator:: |
public | function |
Validates a value against a constraint or a list of constraints. Overrides ValidatorInterface:: |
1 |
RecursiveValidator:: |
public | function |
Validates a property of an object against the constraints specified
for this property. Overrides ValidatorInterface:: |
|
RecursiveValidator:: |
public | function |
Validates a value against the constraints specified for an object's
property. Overrides ValidatorInterface:: |
|
RecursiveValidator:: |
public | function | Creates a new validator. |