Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/validator/Constraints/ExpressionValidator.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
21 * @author Fabien Potencier <fabien@symfony.com> | 21 * @author Fabien Potencier <fabien@symfony.com> |
22 * @author Bernhard Schussek <bschussek@symfony.com> | 22 * @author Bernhard Schussek <bschussek@symfony.com> |
23 */ | 23 */ |
24 class ExpressionValidator extends ConstraintValidator | 24 class ExpressionValidator extends ConstraintValidator |
25 { | 25 { |
26 /** | |
27 * @var ExpressionLanguage | |
28 */ | |
29 private $expressionLanguage; | 26 private $expressionLanguage; |
30 | 27 |
31 public function __construct($propertyAccessor = null, ExpressionLanguage $expressionLanguage = null) | 28 public function __construct($propertyAccessor = null, ExpressionLanguage $expressionLanguage = null) |
32 { | 29 { |
33 $this->expressionLanguage = $expressionLanguage; | 30 $this->expressionLanguage = $expressionLanguage; |
46 $variables['value'] = $value; | 43 $variables['value'] = $value; |
47 $variables['this'] = $this->context->getObject(); | 44 $variables['this'] = $this->context->getObject(); |
48 | 45 |
49 if (!$this->getExpressionLanguage()->evaluate($constraint->expression, $variables)) { | 46 if (!$this->getExpressionLanguage()->evaluate($constraint->expression, $variables)) { |
50 $this->context->buildViolation($constraint->message) | 47 $this->context->buildViolation($constraint->message) |
51 ->setParameter('{{ value }}', $this->formatValue($value)) | 48 ->setParameter('{{ value }}', $this->formatValue($value, self::OBJECT_TO_STRING)) |
52 ->setCode(Expression::EXPRESSION_FAILED_ERROR) | 49 ->setCode(Expression::EXPRESSION_FAILED_ERROR) |
53 ->addViolation(); | 50 ->addViolation(); |
54 } | 51 } |
55 } | 52 } |
56 | 53 |