I have the following in my config.yml
services: my.user_provider: class: Acme\MySecurityBundle\Security\UserProvider
but would like to move this to config.yml in my MySecurityBundle/Resources/config
but Symfony2 tells me that the service doesn't exist when I move it.
How do I get it to pick up the config.yml
file from there?
src/Acme/MySecurityBundle/DependencyInjection/MySecurityExtension.php
:
<?php namespace Acme\MySecurityBundle\DependencyInjection; use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\Config\FileLocator; class MySecurityExtension extends Extension { public function load(array $configs, ContainerBuilder $container) { $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.yml'); } }
src/Acme/MySecurityBundle/Resources/config/services.yml
:
services: my_security.user_provider: class: Acme\MySecurityBundle\Security\UserProvider
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With