[Validator] Updated outdated doc blocks
This commit is contained in:
parent
8558377945
commit
dbce5a2f6a
@ -19,7 +19,7 @@ use Symfony\Component\Validator\Exception\OutOfBoundsException;
|
|||||||
* When validating a group sequence, each group will only be validated if all
|
* When validating a group sequence, each group will only be validated if all
|
||||||
* of the previous groups in the sequence succeeded. For example:
|
* of the previous groups in the sequence succeeded. For example:
|
||||||
*
|
*
|
||||||
* $validator->validateObject($address, new GroupSequence('Basic', 'Strict'));
|
* $validator->validate($address, new Valid(), new GroupSequence('Basic', 'Strict'));
|
||||||
*
|
*
|
||||||
* In the first step, all constraints that belong to the group "Basic" will be
|
* In the first step, all constraints that belong to the group "Basic" will be
|
||||||
* validated. If none of the constraints fail, the validator will then validate
|
* validated. If none of the constraints fail, the validator will then validate
|
||||||
@ -42,12 +42,12 @@ use Symfony\Component\Validator\Exception\OutOfBoundsException;
|
|||||||
* Whenever you validate that object in the "Default" group, the group sequence
|
* Whenever you validate that object in the "Default" group, the group sequence
|
||||||
* will be validated:
|
* will be validated:
|
||||||
*
|
*
|
||||||
* $validator->validateObject($address);
|
* $validator->validate($address, new Valid());
|
||||||
*
|
*
|
||||||
* If you want to execute the constraints of the "Default" group for a class
|
* If you want to execute the constraints of the "Default" group for a class
|
||||||
* with an overridden default group, pass the class name as group name instead:
|
* with an overridden default group, pass the class name as group name instead:
|
||||||
*
|
*
|
||||||
* $validator->validateObject($address, "Address")
|
* $validator->validate($address, new Valid(), "Address")
|
||||||
*
|
*
|
||||||
* @Annotation
|
* @Annotation
|
||||||
*
|
*
|
||||||
|
@ -11,10 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Validator\Context;
|
namespace Symfony\Component\Validator\Context;
|
||||||
|
|
||||||
use Symfony\Component\Validator\Constraints\GroupSequence;
|
|
||||||
use Symfony\Component\Validator\ConstraintViolationListInterface;
|
|
||||||
use Symfony\Component\Validator\ExecutionContextInterface as LegacyExecutionContextInterface;
|
use Symfony\Component\Validator\ExecutionContextInterface as LegacyExecutionContextInterface;
|
||||||
use Symfony\Component\Validator\Mapping\MetadataInterface;
|
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface;
|
use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface;
|
||||||
|
|
||||||
@ -24,7 +21,7 @@ use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface;
|
|||||||
* The context collects all violations generated during the validation. By
|
* The context collects all violations generated during the validation. By
|
||||||
* default, validators execute all validations in a new context:
|
* default, validators execute all validations in a new context:
|
||||||
*
|
*
|
||||||
* $violations = $validator->validateObject($object);
|
* $violations = $validator->validate($object);
|
||||||
*
|
*
|
||||||
* When you make another call to the validator, while the validation is in
|
* When you make another call to the validator, while the validation is in
|
||||||
* progress, the violations will be isolated from each other:
|
* progress, the violations will be isolated from each other:
|
||||||
@ -34,7 +31,7 @@ use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface;
|
|||||||
* $validator = $this->context->getValidator();
|
* $validator = $this->context->getValidator();
|
||||||
*
|
*
|
||||||
* // The violations are not added to $this->context
|
* // The violations are not added to $this->context
|
||||||
* $violations = $validator->validateObject($value);
|
* $violations = $validator->validate($value);
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* However, if you want to add the violations to the current context, use the
|
* However, if you want to add the violations to the current context, use the
|
||||||
@ -47,7 +44,7 @@ use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface;
|
|||||||
* // The violations are added to $this->context
|
* // The violations are added to $this->context
|
||||||
* $validator
|
* $validator
|
||||||
* ->inContext($this->context)
|
* ->inContext($this->context)
|
||||||
* ->validateObject($value)
|
* ->validate($value)
|
||||||
* ;
|
* ;
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user