You are here

public function ExecutionContext::getValidator in Plug 7

Returns the validator.

Useful if you want to validate additional constraints:

public function validate($value, Constraint $constraint) { $validator = $this->context->getValidator();

$violations = $validator->validateValue($value, new Length(array('min' => 3)));

if (count($violations) > 0) { // ... } }

Return value

ValidatorInterface

Overrides ExecutionContextInterface::getValidator

File

lib/Symfony/validator/Symfony/Component/Validator/Context/ExecutionContext.php, line 239

Class

ExecutionContext
The context used and created by {@link ExecutionContextFactory}.

Namespace

Symfony\Component\Validator\Context

Code

public function getValidator() {
  return $this->validator;
}