Skip to content

Commit

Permalink
Fix validator (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
wbloszyk authored Jun 8, 2020
1 parent b5a7b34 commit d8bc009
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Validator/InlineValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Sonata\Form\Validator;

use Sonata\CoreBundle\Validator\ErrorElement as DeprecatedErrorElement;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
Expand Down Expand Up @@ -65,6 +66,15 @@ public function validate($value, Constraint $constraint)
*/
protected function getErrorElement($value)
{
if (class_exists(DeprecatedErrorElement::class)) {
return new DeprecatedErrorElement(
$value,
$this->constraintValidatorFactory,
$this->context,
$this->context->getGroup()
);
}

return new ErrorElement(
$value,
$this->constraintValidatorFactory,
Expand Down

0 comments on commit d8bc009

Please sign in to comment.