I'm trying something so much time but maybe it's not even possible. Sorry for my bad language. So, I followed Symfony Doc https://symfony.com/doc/current/bundles.html to create new Bundle, and than I followed https://symfony.com/doc/current/bundles/extension.html to create DI extension.
My files: AcmeHelloExtension.php
namespace App\Acme\HelloBundle\DependencyInjection;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class AcmeHelloExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$loader = new XmlFileLoader(
$container,
new FileLocator(__DIR__.'/../Resources/config')
);
$loader->load('services.xml');
}
}
AcmeHelloBundle.php
namespace App\Acme\HelloBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class AcmeHelloBundle extends Bundle
{
}
I added it to config/bundles.php
src/Acme/HelloBundle/Resources/config/services.yaml
services:
App\Acme\HelloBundle\AcmeHelloBundle:
tags: ['example-tags']
This service file isn't auto loaded, do I need to do next steps or it should work? When I check it with debug:container ....bundle... Option-Tags has empty value. When I put this code in config/services.yaml it works.
App\Acme\HelloBundle\AcmeHelloBundle::class => ['all' => true]
Now, it load service file, I tried it with die statement. But it does not want to change my service config. Ok, I will make new project and post github link here. Just few min... – tila98