Note that there are some explanatory texts on larger screens.

plurals
  1. POSymfony2: Is it possible to add configuration for another bundle via DependencyInjection?
    primarykey
    data
    text
    <p>In Symfony2's config.yml you can add an "import" such as:</p> <pre><code>imports: - { resource: services.yml } </code></pre> <p>Inside my services.yml I then have:</p> <pre><code>imports: security_bundle: resource: @AcmeSecurityBundle/Resources/config/services.yml </code></pre> <p>However the alternative way to declare services for a bundle is by using a <code>DependencyInjection</code> <code>Extension</code> thus eliminating the need to import anything into config.yml manually thus decoupling the code.</p> <pre><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-&gt;load('services.yml'); } } </code></pre> <p><strong>The Question</strong> This works fine for service declarations but say for instance you want a bundle to configure another bundle such as adding <code>LiipImagineBundle</code> (it's like <code>AvalancheImagineBundle</code>) filters:</p> <pre><code>liip_imagine: filter_sets: security_avatar_thumbnail: quality: 75 filters: thumbnail: { size: [140, 140], mode: inset } </code></pre> <p>Symfony then complains that</p> <blockquote> <p>There is no extension able to load the configuration for "liip_imagine"</p> </blockquote> <p>So does anyone know if there is a way to add configuration for third party bundle from another bundle without touching <code>config.yml</code>?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload