ConstraintValidatorFactory.php in Plug 7
File
lib/Symfony/validator/Symfony/Component/Validator/ConstraintValidatorFactory.php
View source
<?php
namespace Symfony\Component\Validator;
use Symfony\Component\Validator\Constraints\ExpressionValidator;
class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface {
protected $validators = array();
private $propertyAccessor;
public function __construct($propertyAccessor = null) {
$this->propertyAccessor = $propertyAccessor;
}
public function getInstance(Constraint $constraint) {
$className = $constraint
->validatedBy();
if (!isset($this->validators[$className])) {
$this->validators[$className] = 'validator.expression' === $className ? new ExpressionValidator($this->propertyAccessor) : new $className();
}
return $this->validators[$className];
}
}