From 1610c35050194381e7e36d0a166fe69c39b69e3c Mon Sep 17 00:00:00 2001 From: Steve Nebes Date: Wed, 25 Sep 2019 11:36:02 -0500 Subject: [PATCH] Allow entity usage in ChoiceFilterType per doctrine/orm:v2.6.4 changes --- Event/Subscriber/AbstractDoctrineSubscriber.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Event/Subscriber/AbstractDoctrineSubscriber.php b/Event/Subscriber/AbstractDoctrineSubscriber.php index d192174..e2a5914 100644 --- a/Event/Subscriber/AbstractDoctrineSubscriber.php +++ b/Event/Subscriber/AbstractDoctrineSubscriber.php @@ -2,11 +2,12 @@ namespace Lexik\Bundle\FormFilterBundle\Event\Subscriber; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\DBAL\Connection; +use Doctrine\DBAL\Types\Type; use Lexik\Bundle\FormFilterBundle\Filter\FilterOperands; use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\BooleanFilterType; use Lexik\Bundle\FormFilterBundle\Event\GetFilterConditionEvent; -use Doctrine\DBAL\Connection; -use Doctrine\DBAL\Types\Type; /** * Provide Doctrine ORM and DBAL filters. @@ -30,12 +31,12 @@ public function filterValue(GetFilterConditionEvent $event) if (is_array($values['value']) && sizeof($values['value']) > 0) { $event->setCondition( $expr->in($event->getField(), ':'.$paramName), - array($paramName => array($values['value'], Connection::PARAM_STR_ARRAY)) + array($paramName => new ArrayCollection($values['value'])) ); } elseif (!is_array($values['value'])) { $event->setCondition( $expr->eq($event->getField(), ':'.$paramName), - array($paramName => array($values['value'], Type::STRING)) + array($paramName => $values['value']) ); } }