diff --git a/src/DMS/Bundle/FilterBundle/Form/FilterExtension.php b/src/DMS/Bundle/FilterBundle/Form/FilterExtension.php index 75fb8b7..38361f3 100644 --- a/src/DMS/Bundle/FilterBundle/Form/FilterExtension.php +++ b/src/DMS/Bundle/FilterBundle/Form/FilterExtension.php @@ -42,7 +42,7 @@ public function __construct(Filter $filterService, $autoFilter) protected function loadTypeExtensions() { return array( - new FormTypeFilterExtension($this->filter, true), + new FormTypeFilterExtension($this->filter, $this->autoFilter), ); } } diff --git a/src/DMS/Bundle/FilterBundle/Tests/Form/Type/FormTypeFilterExtensionTest.php b/src/DMS/Bundle/FilterBundle/Tests/Form/Type/FormTypeFilterExtensionTest.php index bcb47b4..51c9bfa 100644 --- a/src/DMS/Bundle/FilterBundle/Tests/Form/Type/FormTypeFilterExtensionTest.php +++ b/src/DMS/Bundle/FilterBundle/Tests/Form/Type/FormTypeFilterExtensionTest.php @@ -82,6 +82,13 @@ public function testFilterSubscriberDisabled() $dispatcher = $form->getConfig()->getEventDispatcher(); $listeners = $dispatcher->getListeners(FormEvents::POST_SUBMIT); + $filter = function ($value) { + return (get_class($value[0]) == "DMS\Bundle\FilterBundle\Form\EventListener\DelegatingFilterListener"); + }; + + $filterListeners = array_filter($listeners, $filter); + + $this->assertEquals(0, count($filterListeners)); } public function testBindValidatesData()