Symfony Injection Injection Does Not Run Download Function

I am trying to create my own CMS using the Symfony stack, and I already have some problems with Injection Dependency.

What am i trying to do
Download the "Extension" of each module installed on the CMS, so the service parameters and doctrines can be combined.

What am I doing
Running Symfony Flex (Symfony 4) I have in src / Kernel.php: (in the configureContainer function)

foreach ($this->getInstalledModules() as $module) { $class = 'App\\Modules\\' . $module . '\\DependencyInjection\\' . $module . 'Extension'; if (class_exists($class)) { $container->registerExtension(new $class()); } } 

I have my modules stored in src/Modules/[module_name] , the dependency loader for each module is in src/Modules/[module_name]/DependencyInjection/[module_name]Extension.php with the namespace App\Modules\Articles\DependencyInjection

My extension for the module:

 class ArticlesExtension extends Extension implements PrependExtensionInterface { public function load(array $configs, ContainerBuilder $container) { die("LOADING"); $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('services.yml'); } public function prepend(ContainerBuilder $container) { $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('doctrine.yml'); } } 

As you can see, I added die for testing, the problem is that this does not work (with or without a matrix). The prepend function, although executed, works by registering my doctrine objects accordingly.

You can find my repository by visiting this link: http://lab.cirykpopeye.be/cirykpopeye/Cirykpopeye.be/tree/development

0
source share

Source: https://habr.com/ru/post/1274260/


All Articles