From a39bad9aff89547a8437272e3e3e4f60e527e8df Mon Sep 17 00:00:00 2001 From: Kevin Pfeifer Date: Tue, 21 Oct 2025 15:26:23 +0200 Subject: [PATCH] add events hook to application --- src/Application.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Application.php b/src/Application.php index e56d81801..d2213e9e1 100644 --- a/src/Application.php +++ b/src/Application.php @@ -20,6 +20,7 @@ use Cake\Core\ContainerInterface; use Cake\Datasource\FactoryLocator; use Cake\Error\Middleware\ErrorHandlerMiddleware; +use Cake\Event\EventManagerInterface; use Cake\Http\BaseApplication; use Cake\Http\Middleware\BodyParserMiddleware; use Cake\Http\Middleware\CsrfProtectionMiddleware; @@ -102,4 +103,18 @@ public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue public function services(ContainerInterface $container): void { } + + /** + * Register custom event listeners here + * + * @param \Cake\Event\EventManagerInterface $eventManager + * @return \Cake\Event\EventManagerInterface + * @link https://book.cakephp.org/5/en/core-libraries/events.html#registering-listeners + */ + public function events(EventManagerInterface $eventManager): EventManagerInterface + { + // $eventManager->on(new SomeCustomListenerClass()); + + return $eventManager; + } }