From b070a10e3e95503a51d1189626dc6bb87d66cb78 Mon Sep 17 00:00:00 2001 From: Julio Date: Thu, 9 Sep 2021 09:10:28 +0200 Subject: [PATCH] Minor - refactor services --- config/services.yaml | 2 +- public/main/install/install.lib.php | 2 +- src/CoreBundle/Resources/config/listeners.yml | 6 +++--- src/CoreBundle/Resources/config/services.xml | 21 ------------------- src/CoreBundle/Resources/config/services.yml | 10 ++++++++- src/CoreBundle/Traits/ControllerTrait.php | 4 ++-- 6 files changed, 16 insertions(+), 29 deletions(-) diff --git a/config/services.yaml b/config/services.yaml index 1f6ec51038..904a584a47 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -64,7 +64,7 @@ services: # Locale listener Chamilo\CoreBundle\EventSubscriber\LocaleSubscriber: - arguments: ['%kernel.default_locale%', '@chamilo.settings.manager', '@parameter_bag'] + arguments: ['%kernel.default_locale%', '@Chamilo\CoreBundle\Settings\SettingsManager', '@parameter_bag'] cocur_slugify: lowercase: true diff --git a/public/main/install/install.lib.php b/public/main/install/install.lib.php index a80718cc1d..a98d7cf863 100644 --- a/public/main/install/install.lib.php +++ b/public/main/install/install.lib.php @@ -2044,7 +2044,7 @@ function installTools($container, $manager, $upgrade = false) function installSchemas($container, $upgrade = false) { error_log('installSchemas'); - $settingsManager = $container->get('chamilo.settings.manager'); + $settingsManager = $container->get(Chamilo\CoreBundle\Settings\SettingsManager::class); $urlRepo = $container->get(AccessUrlRepository::class); $accessUrl = $urlRepo->find(1); diff --git a/src/CoreBundle/Resources/config/listeners.yml b/src/CoreBundle/Resources/config/listeners.yml index 86414204d0..21e8b27918 100644 --- a/src/CoreBundle/Resources/config/listeners.yml +++ b/src/CoreBundle/Resources/config/listeners.yml @@ -64,7 +64,7 @@ services: # Auth listeners Chamilo\CoreBundle\EventListener\LoginSuccessHandler: - arguments: ['@router', '@security.authorization_checker', '@chamilo.settings.manager'] + arguments: ['@router', '@security.authorization_checker', 'Chamilo\CoreBundle\Settings\SettingsManager'] tags: - {name: kernel.event_listener, event: security.interactive_login, method: onSecurityInteractiveLogin} @@ -99,7 +99,7 @@ services: # When the Course entity is created/updated Chamilo\CoreBundle\Entity\Listener\CourseListener: - arguments: ['@Chamilo\CoreBundle\Tool\ToolChain', '@chamilo.settings.manager'] + arguments: ['@Chamilo\CoreBundle\Tool\ToolChain', 'Chamilo\CoreBundle\Settings\SettingsManager'] tags: - {name: doctrine.orm.entity_listener, entity_manager: default, lazy: true} @@ -118,7 +118,7 @@ services: Chamilo\CoreBundle\Entity\Listener\SkillRelUserListener: arguments: - - '@chamilo.settings.manager' + - '@Chamilo\CoreBundle\Settings\SettingsManager' - '@router' - '@translator' tags: diff --git a/src/CoreBundle/Resources/config/services.xml b/src/CoreBundle/Resources/config/services.xml index e8a0d0e916..5725fe4963 100644 --- a/src/CoreBundle/Resources/config/services.xml +++ b/src/CoreBundle/Resources/config/services.xml @@ -17,17 +17,6 @@ %chamilo_settings.repository.parameter.entity.class% - - - - - - - - - - - @@ -35,15 +24,5 @@ - - - - - - - - - - diff --git a/src/CoreBundle/Resources/config/services.yml b/src/CoreBundle/Resources/config/services.yml index 1c99f548bf..970e895417 100644 --- a/src/CoreBundle/Resources/config/services.yml +++ b/src/CoreBundle/Resources/config/services.yml @@ -66,9 +66,17 @@ services: Chamilo\CoreBundle\Repository\AssetRepository: ~ + Chamilo\CoreBundle\Settings\SettingsManager: + arguments: + - '@sylius.registry.settings_schema' + - '@doctrine.orm.entity_manager' + - '@chamilo_settings.repository' + - '@event_dispatcher' + - '@request_stack' + Chamilo\CoreBundle\Twig\SettingsHelper: arguments: - - '@chamilo.settings.manager' + - '@Chamilo\CoreBundle\Settings\SettingsManager' tags: - {name: templating.helper, alias: chamilo_settings} diff --git a/src/CoreBundle/Traits/ControllerTrait.php b/src/CoreBundle/Traits/ControllerTrait.php index 285de7045d..df4253635f 100644 --- a/src/CoreBundle/Traits/ControllerTrait.php +++ b/src/CoreBundle/Traits/ControllerTrait.php @@ -48,9 +48,9 @@ trait ControllerTrait $services = AbstractController::getSubscribedServices(); $services['translator'] = TranslatorInterface::class; $services['glide'] = Glide::class; - $services['chamilo.settings.manager'] = SettingsManager::class; $services['chamilo_settings.form_factory.settings'] = SettingsFormFactory::class; + $services[] = SettingsManager::class; $services[] = MessageAttachmentRepository::class; $services[] = ResourceFactory::class; $services[] = ResourceNodeRepository::class; @@ -131,7 +131,7 @@ trait ControllerTrait */ protected function getSettingsManager() { - return $this->container->get('chamilo.settings.manager'); + return $this->container->get(SettingsManager::class); } protected function getSettingsFormFactory()