How do I fix "Add myBundle to the asseticBundle config" symfony2 exception? How do I fix "Add myBundle to the asseticBundle config" symfony2 exception? symfony symfony

How do I fix "Add myBundle to the asseticBundle config" symfony2 exception?


Yes I tried and it solved the issue for me. For someone (like me) who doesn't know initially how to add then just:

  1. edit app/config/config.yml
  2. then go to assetic:
  3. under assetic: go to bundles: []
  4. and in bundles: [] //type your bundle name

for instance if your bundle is Acme\DemoBundle, then do the following

assetic:   bundles: [ AcmeDemoBundle ]

No quotes around AcmeDemoBundle. That's it. (Symfony2)


If you want assetic to include your bundles by default, you can comment (with #) the line bundles: []

ex:

assetic:    debug:          "%kernel.debug%"    use_controller: false    #bundles:        [ ]    #java: /usr/bin/java


Sometimes you need to make decisions on the fly, then you can use use DependencyInjection.

For example to loads and manages configuration:

<?phpnamespace You\ExampeBundle\DependencyInjection;use Symfony\Component\DependencyInjection\ContainerBuilder;/* ... */class YouExampeExtension extends Extension{    /* ... */    public function load(array $configs, ContainerBuilder $container)    {        /* ... */        $aAsseticBundle = $container->getParameter('assetic.bundles');        $aAsseticBundle[] = 'YouExampeBundle';        $aAsseticBundle[] = 'AnotheBundle';        $container->setParameter('assetic.bundles', $aAsseticBundle);        /* ... */    }}

You can use more complex logic to manipulate the configuration(in reasonable limits)