Minor - refactor services

pull/3965/head
Julio 3 years ago
parent 3d3d69beb1
commit b070a10e3e
  1. 2
      config/services.yaml
  2. 2
      public/main/install/install.lib.php
  3. 6
      src/CoreBundle/Resources/config/listeners.yml
  4. 21
      src/CoreBundle/Resources/config/services.xml
  5. 10
      src/CoreBundle/Resources/config/services.yml
  6. 4
      src/CoreBundle/Traits/ControllerTrait.php

@ -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

@ -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);

@ -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:

@ -17,17 +17,6 @@
<argument>%chamilo_settings.repository.parameter.entity.class%</argument>
</service>
<service id="chamilo.settings.manager" class="%chamilo_settings.settings.manager.class%" public="true" >
<argument type="service" id="sylius.registry.settings_schema" />
<argument type="service" id="doctrine.orm.entity_manager" />
<argument type="service" id="chamilo_settings.repository" />
<argument type="service" id="event_dispatcher" />
<argument type="service" id="request_stack" />
</service>
<service id="%chamilo_settings.settings.manager.class%" alias="chamilo.settings.manager">
</service>
<service id="chamilo_settings.form_factory.settings" public="true" class="Sylius\Bundle\SettingsBundle\Form\Factory\SettingsFormFactory">
<argument type="service" id="sylius.registry.settings_schema" />
<argument type="service" id="form.factory" />
@ -35,15 +24,5 @@
<service id="Sylius\Bundle\SettingsBundle\Form\Factory\SettingsFormFactory" alias="chamilo_settings.form_factory.settings">
</service>
<!-- <service id="chamilo_settings.templating.helper.settings" class="%chamilo_settings.templating.helper.settings.class%" public="true">-->
<!-- <argument type="service" id="chamilo.settings.manager" />-->
<!-- <tag name="templating.helper" alias="chamilo_settings" />-->
<!-- </service>-->
<!-- <service id="chamilo.twig.extension.settings" class="%chamilo_settings.twig.extension.settings.class%" public="false">-->
<!-- <argument type="service" id="chamilo_settings.templating.helper.settings" />-->
<!-- <tag name="twig.extension" />-->
<!-- </service>-->
</services>
</container>

@ -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}

@ -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()

Loading…
Cancel
Save