Skip to content

Commit 002f6e5

Browse files
committed
updated base event listener classes to match event types
1 parent 870d71c commit 002f6e5

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

src/Event/ControllerEventListenerInterface.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,10 @@ interface ControllerEventListenerInterface extends ListenerAggregateInterface
2222
/**
2323
* @param ControllerEvent $e
2424
*/
25-
public function onDispatch(ControllerEvent $e);
25+
public function onBeforeDispatch(ControllerEvent $e);
26+
27+
/**
28+
* @param ControllerEvent $e
29+
*/
30+
public function onAfterDispatch(ControllerEvent $e);
2631
}

src/Event/ControllerEventListenerTrait.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,23 @@ trait ControllerEventListenerTrait
2727
public function attach(EventManagerInterface $events, $priority = 1)
2828
{
2929
$this->listeners[] = $events->attach(
30-
ControllerEvent::EVENT_CONTROLLER_DISPATCH,
31-
[$this, 'onDispatch'],
30+
ControllerEvent::EVENT_CONTROLLER_BEFORE_DISPATCH,
31+
[$this, 'onBeforeDispatch'],
3232
$priority
3333
);
34+
$this->listeners[] = $events->attach(
35+
ControllerEvent::EVENT_CONTROLLER_AFTER_DISPATCH,
36+
[$this, 'onAfterDispatch'],
37+
$priority
38+
);
39+
}
40+
41+
public function onBeforeDispatch(ControllerEvent $e)
42+
{
43+
//no-op
3444
}
3545

36-
public function onDispatch(ControllerEvent $e)
46+
public function onAfterDispatch(ControllerEvent $e)
3747
{
3848
//no-op
3949
}

0 commit comments

Comments
 (0)