vendor/eckinox/core-bundle/src/DependencyInjection/EckinoxCoreExtension.php line 26

Open in your IDE?
  1. <?php
  2. namespace Eckinox\CoreBundle\DependencyInjection;
  3. use Symfony\Component\DependencyInjection\ContainerBuilder;
  4. use Symfony\Component\DependencyInjection\Extension\Extension;
  5. use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
  6. use Symfony\Component\Config\FileLocator;
  7. use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
  8. use Eckinox\CoreBundle\Cron\CronInterface;
  9. class EckinoxCoreExtension extends Extension implements PrependExtensionInterface
  10. {
  11.     public function load(array $configsContainerBuilder $container)
  12.     {
  13.         $configs $this->processConfiguration($this->getConfiguration([], $container), $configs);
  14.         $loader = new YamlFileLoader(
  15.             $container,
  16.             new FileLocator(__DIR__.'/../../config')
  17.         );
  18.         $loader->load('services.yaml');
  19.         if ($configs['crons']) {
  20.             trigger_deprecation('eckinox/core-bundle''1.2''Using "%s" configuration is deprecated, use "%s" instead.''eckinox_core.crons 'CronInterface::class);
  21.         }
  22.         $container->setParameter('eckinox_core.crons'$configs['crons']);
  23.         $container->registerForAutoconfiguration(CronInterface::class)
  24.             ->addTag('eckinox_core.cron')
  25.         ;
  26.     }
  27.     public function prepend(ContainerBuilder $container): void
  28.     {
  29.         $bundleList $container->getParameter('kernel.bundles');
  30.         // Set default privileges
  31.         if(array_key_exists('EckinoxSecurityBundle',$bundleList)) {
  32.             $container->prependExtensionConfig('eckinox_security', [
  33.                 'privileges' => [
  34.                     'log' => [ 'LIST''VIEW' ]
  35.                 ]
  36.             ]);
  37.         }
  38.         // Add migrations path to Doctrine
  39.         $doctrineConfig $container->getExtensionConfig('doctrine_migrations');
  40.         $migrationsPath = (array) array_pop($doctrineConfig)['migrations_paths'];
  41.         $container->prependExtensionConfig('doctrine_migrations', [
  42.             'migrations_paths' => array_merge(
  43.                 $migrationsPath ?? [],
  44.                 [
  45.                     'EckinoxCoreMigrations' => '@EckinoxCoreBundle/migrations',
  46.                 ]
  47.             ),
  48.         ]);
  49.         $container->prependExtensionConfig('doctrine', [
  50.             'orm' => [
  51.                 'mappings' => [
  52.                     'EckinoxCoreBundle' => [
  53.                         'type' => 'annotation',
  54.                         'dir' => 'src/Entity',
  55.                         'is_bundle' => true,
  56.                         'prefix' => 'Eckinox\CoreBundle\Entity',
  57.                         'alias' => 'EckinoxCoreBundle'
  58.                     ]
  59.                 ]
  60.             ]
  61.         ]);
  62.     }
  63. }