From e59b97f0294365827306dc9a3deed9086aa81f4c Mon Sep 17 00:00:00 2001 From: Awilum Date: Fri, 1 Mar 2019 16:55:25 +0300 Subject: [PATCH] Flextype Core: using league/event --- flextype/Plugins.php | 6 +++--- flextype/bootstrap.php | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/flextype/Plugins.php b/flextype/Plugins.php index 5332f9b2..75e823cb 100755 --- a/flextype/Plugins.php +++ b/flextype/Plugins.php @@ -102,11 +102,11 @@ class Plugins } } - Plugins::createPluginsDictionary($plugins_list); + $this->createPluginsDictionary($plugins_list); - Plugins::includeEnabledPlugins($flextype, $app); + $this->includeEnabledPlugins($flextype, $app); - //Event::dispatch('onPluginsInitialized'); + $this->flextype['emitter']->emit('onPluginsInitialized'); } } diff --git a/flextype/bootstrap.php b/flextype/bootstrap.php index cc06cfc7..8cf1836c 100755 --- a/flextype/bootstrap.php +++ b/flextype/bootstrap.php @@ -22,6 +22,7 @@ use Slim\Http\Request; use Slim\Http\Response; use League\Glide\ServerFactory; use League\Glide\Responses\SlimResponseFactory; +use League\Event\Emitter; /** * The version of Flextype @@ -65,6 +66,13 @@ $app = new \Slim\App($config); */ $flextype = $app->getContainer(); +/** + * Add emitter service to Flextype container + */ +$flextype['emitter'] = function($container) { + return new Emitter(); +}; + /** * Add registry service to Flextype container */