Symfony2 the template does not support the "bundle" parameter
Asked Answered
A

3

9

I'm working on a project with friends, using git. Yesterday, a friend pushed some stuff relative to his bundle, but after I pull it, I got this strange error message

An exception has been thrown during the compilation of a template ("The template does not support the "bundle" parameter.") in "layout.html.twig".

I figured out that it's linked to assetic (I tried to remove all my assets and it worked again, but without js nor css files) and it's doing that with all my pages.

The point is, it doesnt work for me, but it works for him. Now, I tried to cache:clear an uncountable amount of times, doctrine:schema:update too. I just want to know what could be the cause of this error, why it's not working so suddenly, and if there's anything I can do about it...

I already tried this even though it's not exactly my problem, doesnt work. Here is my assetic configuration in config.yml, even though wasnt modified

assetic:
debug:          "%kernel.debug%"
use_controller: false
bundles:        []

#java: /usr/bin/java
filters:
    cssrewrite: ~
    #closure:
    #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"
    #yui_css:
    #    jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
assets:
    jquery: %kernel.root_dir%/../vendor/components/jquery/jquery.min.js

Thanks a lot for your help guys !

Edit : where my problem appears to be

The problem doesnt appear in the {% extends %} or at least not for now. It appears in the

{% stylesheets '@AppBundle/Resources/public/css/*' %}
    <link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}

{% javascripts
    '@AppBundle/Resources/public/js/alwaysIncluded/*'
    '@AppBundle/Resources/public/js/layout.js'
%}
    <script src="{{ asset_url }}"></script>
{% endjavascripts %}

I tried to remove the @ but it doesnt change anything.

Second edit

Complete config.yml file (hosted on dropbox cause it's a big file, will either upload it on something better or post it full length if required)

Apochromatic answered 9/1, 2015 at 12:43 Comment(4)
can you post the entire config.yml files?Untune
You also have to modify the first "/" to : I think.Nonintervention
just tried, also tried to use the css from /web directory, doesnt work either...Apochromatic
Same issue and I don't have any @Bundle annotation, I have implemented the whole AppBundle philosophy and I also have this error. reverting back to 2.6.1Lytle
O
5

You need to update your composer.json as follows:

    "symfony/symfony": "~2.6",
    "symfony/assetic-bundle": "dev-master",

The error comes from assetic in version 2.5.0. The dev version corrects this as explained here: https://github.com/Spea/SpBowerBundle/issues/119

Obedience answered 12/1, 2015 at 22:35 Comment(0)
N
6

The following syntax doesn't work any-more with Symfony 2.6.3 and its default requirements.

If you want to stay with Symfony 2.6.3 without changing the assetic requirement (using dev-master in production is never a good idea...)

Change (@xxx):

{% extends '@MyBundle/layout.html.twig' %}

To:

{% extends 'MyBundle::layout.html.twig' %}

Or stay with Symfony 2.6.3 and use the dev-master requirement of the assetic-bundle as suggested in the accepted answer.

Or switch back to Symfony 2.6.1, I suppose this issue (and the assetic requirement) will be fixed in Symfony 2.6.4.

Check out the issue on Github.

Nonintervention answered 9/1, 2015 at 13:52 Comment(0)
O
5

You need to update your composer.json as follows:

    "symfony/symfony": "~2.6",
    "symfony/assetic-bundle": "dev-master",

The error comes from assetic in version 2.5.0. The dev version corrects this as explained here: https://github.com/Spea/SpBowerBundle/issues/119

Obedience answered 12/1, 2015 at 22:35 Comment(0)
M
2

If you are trying to include base.html.twig from one of your templates like this:

{% extends 'base.html.twig' %}

You need to change it to this:

{% extends '::base.html.twig' %}

More information here.

Margarine answered 13/1, 2015 at 12:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.