In Symfony2's config.yml you can add an "import" such as:
imports:
- { resource: services.yml }
Inside my services.yml I then have:
imports:
security_bundle:
resource: @AcmeSecurityBundle/Resources/config/services.yml
However the alternative way to declare services for a bundle is by using a DependencyInjection
Extension
thus eliminating the need to import anything into config.yml manually thus decoupling the code.
namespace Acme\Bundle\SecurityBundle\DependencyInjection;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\Config\FileLocator;
class AcmeSecurityExtension extends Extension {
public function load(array $configs, ContainerBuilder $container) {
$loader = new YamlFileLoader(
$container, new FileLocator(__DIR__ . '/../Resources/config')
);
$loader->load('services.yml');
}
}
The Question
This works fine for service declarations but say for instance you want a bundle to configure another bundle such as adding LiipImagineBundle
(it's like AvalancheImagineBundle
) filters:
liip_imagine:
filter_sets:
security_avatar_thumbnail:
quality: 75
filters:
thumbnail: { size: [140, 140], mode: inset }
Symfony then complains that
There is no extension able to load the configuration for "liip_imagine"
So does anyone know if there is a way to add configuration for third party bundle from another bundle without touching config.yml
?