5
5
use Symfony \Component \Form \AbstractType ;
6
6
use Symfony \Component \Form \Form ;
7
7
use Symfony \Component \Form \FormInterface ;
8
- use Symfony \Component \EventDispatcher \EventDispatcherInterface ;
8
+ use Symfony \Contracts \EventDispatcher \EventDispatcherInterface ;
9
9
use Lexik \Bundle \FormFilterBundle \Filter \Condition \ConditionBuilder ;
10
10
use Lexik \Bundle \FormFilterBundle \Filter \Condition \ConditionBuilderInterface ;
11
11
use Lexik \Bundle \FormFilterBundle \Filter \Condition \ConditionInterface ;
@@ -85,7 +85,8 @@ public function addFilterConditions(FormInterface $form, $queryBuilder, $alias =
85
85
{
86
86
// create the right QueryInterface object
87
87
$ event = new PrepareEvent ($ queryBuilder );
88
- $ this ->dispatcher ->dispatch (FilterEvents::PREPARE , $ event );
88
+
89
+ $ this ->dispatcher ->dispatch ($ event , FilterEvents::PREPARE );
89
90
90
91
if (!$ event ->getFilterQuery () instanceof QueryInterface) {
91
92
throw new \RuntimeException ("Couldn't find any filter query object. " );
@@ -103,7 +104,8 @@ public function addFilterConditions(FormInterface $form, $queryBuilder, $alias =
103
104
104
105
// walk condition nodes to add condition on the query builder instance
105
106
$ name = sprintf ('lexik_filter.apply_filters.%s ' , $ event ->getFilterQuery ()->getEventPartName ());
106
- $ this ->dispatcher ->dispatch ($ name , new ApplyFilterConditionEvent ($ queryBuilder , $ this ->conditionBuilder ));
107
+
108
+ $ this ->dispatcher ->dispatch (new ApplyFilterConditionEvent ($ queryBuilder , $ this ->conditionBuilder ), $ name );
107
109
108
110
$ this ->conditionBuilder = null ;
109
111
@@ -207,7 +209,8 @@ protected function getFilterCondition(FormInterface $form, AbstractType $formTyp
207
209
}
208
210
209
211
$ event = new GetFilterConditionEvent ($ filterQuery , $ field , $ values );
210
- $ this ->dispatcher ->dispatch ($ eventName , $ event );
212
+
213
+ $ this ->dispatcher ->dispatch ($ event , $ eventName );
211
214
212
215
$ condition = $ event ->getCondition ();
213
216
}
0 commit comments