I am trying to add an event listener / dispatcher to one of my controller actions. The goal is to add default data to my object before continuing in my database.
Here is what I got so far.
app.php
$app['dispatcher']->addListener('my_event_name', function (Event $event) {
});
As a result, the following error appears:
(!) InvalidArgumentException: The dispatcher identifier does not contain an object definition. in /var/www/site/vendor/pimple/pimple/src/Pimple/Container.php on line 233
source
share