From c5029a5d442efd61b6af7f06c0b6fbe8d427dfbb Mon Sep 17 00:00:00 2001 From: Khoubza Younes Date: Sun, 6 Dec 2020 04:03:14 +0100 Subject: [PATCH] fix event dispatcher and call the storage service --- DependencyInjection/Configuration.php | 4 ++-- ...tension.php => FlasherToastrExtension.php} | 6 +++--- ...oastrBundle.php => FlasherToastrBundle.php | 2 +- Resources/config/services.yaml | 20 +++++++++---------- composer.json | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) rename DependencyInjection/{NotifyToastrExtension.php => FlasherToastrExtension.php} (85%) rename NotifyToastrBundle.php => FlasherToastrBundle.php (69%) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 6d8cbae0..3c8e5b51 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -12,13 +12,13 @@ final class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder('notify_toastr'); + $treeBuilder = new TreeBuilder('flasher_toastr'); if (\method_exists($treeBuilder, 'getRootNode')) { $rootNode = $treeBuilder->getRootNode(); } else { // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('notify_toastr'); + $rootNode = $treeBuilder->root('flasher_toastr'); } $rootNode diff --git a/DependencyInjection/NotifyToastrExtension.php b/DependencyInjection/FlasherToastrExtension.php similarity index 85% rename from DependencyInjection/NotifyToastrExtension.php rename to DependencyInjection/FlasherToastrExtension.php index 028ae226..f5bc9ba7 100644 --- a/DependencyInjection/NotifyToastrExtension.php +++ b/DependencyInjection/FlasherToastrExtension.php @@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; use Symfony\Component\DependencyInjection\Loader; use Symfony\Component\HttpKernel\DependencyInjection\Extension; -final class NotifyToastrExtension extends Extension implements PrependExtensionInterface +final class FlasherToastrExtension extends Extension implements PrependExtensionInterface { /** * {@inheritdoc} @@ -29,14 +29,14 @@ final class NotifyToastrExtension extends Extension implements PrependExtensionI */ public function prepend(ContainerBuilder $container) { - if (!$container->hasExtension('notify')) { + if (!$container->hasExtension('flasher')) { throw new \RuntimeException('[Flasher\SymfonyFlasher\PrimeBundle] is not registered'); } $configs = $container->getExtensionConfig($this->getAlias()); $config = $this->processConfiguration(new Configuration(), $configs); - $container->prependExtensionConfig('notify', array( + $container->prependExtensionConfig('flasher', array( 'adapters' => array( 'toastr' => $config, ), diff --git a/NotifyToastrBundle.php b/FlasherToastrBundle.php similarity index 69% rename from NotifyToastrBundle.php rename to FlasherToastrBundle.php index e016d65b..2e08c1eb 100644 --- a/NotifyToastrBundle.php +++ b/FlasherToastrBundle.php @@ -4,6 +4,6 @@ namespace Flasher\Toastr\Symfony; use Symfony\Component\HttpKernel\Bundle\Bundle; -class NotifyToastrBundle extends Bundle +class FlasherToastrBundle extends Bundle { } diff --git a/Resources/config/services.yaml b/Resources/config/services.yaml index f3f3d252..c2697637 100644 --- a/Resources/config/services.yaml +++ b/Resources/config/services.yaml @@ -1,16 +1,16 @@ services: - notify.producer.toastr: - parent: 'notify.producer.abstract' - class: Flasher\Toastr\Prime\Producer\ToastrProducer + flasher.factory.toastr: + parent: 'flasher.abstract_factory' + class: Flasher\Toastr\Prime\ToastrFactory tags: - - { name: 'notify.producer', alias: 'toastr' } + - { name: 'flasher.factory' } - notify.renderer.toastr: - class: Flasher\Toastr\Prime\Renderer\ToastrRenderer + flasher.renderer.toastr: + class: Flasher\Toastr\Prime\ToastrRenderer arguments: - - '@notify.config' + - '@flasher.config' tags: - - { name: 'notify.renderer', alias: 'toastr' } + - { name: 'flasher.renderer' } - Flasher\Toastr\Prime\Producer\ToastrProducer: '@notify.producer.toastr' - Flasher\Toastr\Prime\Renderer\ToastrRenderer: '@notify.renderer.toastr' + Flasher\Toastr\Prime\ToastrFactory: '@flasher.factory.toastr' + Flasher\Toastr\Prime\ToastrRenderer: '@flasher.renderer.toastr' diff --git a/composer.json b/composer.json index a231a005..ec1f9d60 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "php-flasher/flasher-symfony-toastr", + "name": "php-flasher/flasher-toastr-symfony", "type": "symfony-bundle", "description": "Symfony Flasher adapter for toastr.js library for php-flasher/flasher-symfony", "keywords": [