Can't typehint Symfony EventDispatcherInterface to Controller Action

137 views Asked by At

This is my Action

public function indexAction(Request $request,EventDispatcherInterface $dispatcher){
$dispatcher->dispatch(TestEvent::Name, new TestEvent(new test());
...
}

but it throws the error ...MyController::indexAction()" requires that you provide a value for the "$dispatcher" argument.

I'm on an old symfony 3.4 project and every single doc page I've read says that the EventDispatcherInterface can be used this way with no config needed.

0

There are 0 answers