9153f0e569
Had to refactor the validation tests at the same time and fixed various small bugs while doing so.
31 lines
699 B
PHP
31 lines
699 B
PHP
<?php
|
|
|
|
namespace Symfony\Tests\Component\Validator\Fixtures;
|
|
|
|
use Symfony\Component\Validator\Constraint;
|
|
use Symfony\Component\Validator\ConstraintValidator;
|
|
use Symfony\Component\Validator\ExecutionContext;
|
|
|
|
class ConstraintAValidator extends ConstraintValidator
|
|
{
|
|
static public $passedContext;
|
|
|
|
public function initialize(ExecutionContext $context)
|
|
{
|
|
parent::initialize($context);
|
|
|
|
self::$passedContext = $context;
|
|
}
|
|
|
|
public function isValid($value, Constraint $constraint)
|
|
{
|
|
if ('VALID' != $value) {
|
|
$this->context->addViolation('message', array('param' => 'value'));
|
|
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|