22
33namespace W3C \LifecycleEventsBundle \Services ;
44
5- use Doctrine \Common \ Persistence \Event \LifecycleEventArgs ;
6- use Doctrine \Common \ Persistence \Event \PreUpdateEventArgs ;
5+ use Doctrine \Persistence \Event \LifecycleEventArgs ;
6+ use Doctrine \Persistence \Event \PreUpdateEventArgs ;
77use Doctrine \Common \Util \ClassUtils ;
88use Symfony \Component \EventDispatcher \EventDispatcherInterface ;
99use W3C \LifecycleEventsBundle \Annotation \Change ;
@@ -110,7 +110,7 @@ private function dispatchCreationEvents()
110110 $ eventArgs = $ creation [1 ];
111111 $ entity = $ eventArgs ->getObject ();
112112
113- $ this ->dispatcher ->dispatch ($ annotation -> event , new $ annotation ->class ($ entity ));
113+ $ this ->dispatcher ->dispatch (new $ annotation ->class ($ entity ), $ annotation -> event );
114114 }
115115 }
116116
@@ -129,7 +129,7 @@ private function dispatchDeletionEvents()
129129 $ identifier = $ deletion [2 ];
130130 $ entity = $ eventArgs ->getObject ();
131131
132- $ this ->dispatcher ->dispatch ($ annotation -> event , new $ annotation ->class ($ entity , $ identifier ));
132+ $ this ->dispatcher ->dispatch (new $ annotation ->class ($ entity , $ identifier ), $ annotation -> event );
133133 }
134134 }
135135
@@ -145,8 +145,8 @@ private function dispatchUpdateEvents()
145145 list ($ annotation , $ entity , $ propertiesChanges , $ collectionsChanges ) = $ update ;
146146
147147 $ this ->dispatcher ->dispatch (
148+ new $ annotation ->class ($ entity , $ propertiesChanges , $ collectionsChanges ),
148149 $ annotation ->event ,
149- new $ annotation ->class ($ entity , $ propertiesChanges , $ collectionsChanges )
150150 );
151151 }
152152 }
@@ -163,8 +163,8 @@ private function dispatchPropertyChangeEvents()
163163 list ($ annotation , $ entity , $ property , $ oldValue , $ newValue ) = $ propertyChange ;
164164
165165 $ this ->dispatcher ->dispatch (
166+ new $ annotation ->class ($ entity , $ property , $ oldValue , $ newValue ),
166167 $ annotation ->event ,
167- new $ annotation ->class ($ entity , $ property , $ oldValue , $ newValue )
168168 );
169169 }
170170 }
@@ -187,8 +187,8 @@ private function dispatchCollectionChangeEvents()
187187 }
188188
189189 $ this ->dispatcher ->dispatch (
190+ new $ annotation ->class ($ entity , $ property , $ deleted , $ added ),
190191 $ annotation ->event ,
191- new $ annotation ->class ($ entity , $ property , $ deleted , $ added )
192192 );
193193 }
194194 }
@@ -330,6 +330,6 @@ public function setAutoDispatch($autoDispatch)
330330 */
331331 public function preAutoDispatch ()
332332 {
333- $ this ->dispatcher ->dispatch (' w3c.lifecycle.preAutoDispatch ' , new PreAutoDispatchEvent ($ this ));
333+ $ this ->dispatcher ->dispatch (new PreAutoDispatchEvent ($ this ), ' w3c.lifecycle.preAutoDispatch ' );
334334 }
335335}
0 commit comments