|
@@ -17,7 +17,8 @@ use Symfony\Component\Form\Form;
|
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
|
use Symfony\Component\PropertyAccess\PropertyPath;
|
|
|
use Symfony\Component\PropertyAccess\PropertyAccess;
|
|
|
-use Symfony\Component\Validator\ValidatorInterface;
|
|
|
+use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface;
|
|
|
+use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|
|
use Symfony\Component\Translation\TranslatorInterface;
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
use Symfony\Component\Security\Acl\Model\DomainObjectInterface;
|
|
@@ -403,7 +404,7 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
|
|
|
protected $securityHandler = null;
|
|
|
|
|
|
/**
|
|
|
- * @var ValidatorInterface $validator
|
|
|
+ * @var ValidatorInterface|LegacyValidatorInterface $validator
|
|
|
*/
|
|
|
protected $validator = null;
|
|
|
|
|
@@ -2591,8 +2592,13 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
|
|
|
/**
|
|
|
* {@inheritdoc}
|
|
|
*/
|
|
|
- public function setValidator(ValidatorInterface $validator)
|
|
|
+ public function setValidator($validator)
|
|
|
{
|
|
|
+ // TODO: Remove it when bumping requirements to SF 2.5+
|
|
|
+ if (!$validator instanceof ValidatorInterface && !$validator instanceof LegacyValidatorInterface) {
|
|
|
+ throw new \InvalidArgumentException('Argument 1 must be an instance of Symfony\Component\Validator\Validator\ValidatorInterface or Symfony\Component\Validator\ValidatorInterface');
|
|
|
+ }
|
|
|
+
|
|
|
$this->validator = $validator;
|
|
|
}
|
|
|
|