sonata-project / SonataCacheBundle

[Abandoned] This bundle provides caching services

Home Page:https://github.com/sonata-project/SonataCacheBundle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Symfony 2.7 BC break

gnutix opened this issue · comments

Because of symfony/twig-bundle@a1d022d, there is a BC break in this bundle :

[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]  
  The parameter "twig.options" must be defined.

SonataCacheBundle.php tries to access twig.options parameter to get base_template_class. Unfortunately, it seems like there is no way to access this value with the current TwigExtension code.

Should an issue be opened on Symfony side ? Or should Sonata code be changed somehow ?

Hit this today trying to upgrade since SF2.7 is now stable.

Is base_template_class available in the container ?

$ ./app/console debug:container --parameters |grep -i base_template_class
$

It is not.

Shouldn't $this->get("twig")->getBaseTemplateClass() work?

i got the same problem with an upgrade from 2.3 to 2.7 today.
i dont' understand how to fix this?

@apfelbox yep, can you create a PR ?

Hi
is it possible that someone give us a explanation about this bug?
Do you have some tips to debug or find some information?
i just upgraded from 2.3 to 2.7, with the change of composer.json file.

my config.yml

# Twig Configuration
twig:
    exception_controller:  Symfony\Bundle\TwigBundle\Controller\ExceptionController::showAction
    form:
        resources:

            # Par défaut:
            - form_div_layout.html.twig

            # Exemple:
            #- MyBundle::form.html.twig
    globals:

        # Exemples:
        #foo:                 "@bar"
        #pi:                  3.14

        # Exemples d'options, mais la manière la plus simple est celle ci-dessus
        #some_variable_name:
            # un id de service qui peut être la valeur
        #    id:                   ~
            # définissez à « service » ou laissez vide
        #    type:                 ~
        #    value:                ~
    autoescape:           ~
    base_template_class:  ~ #Twig_Template
    cache:                "%kernel.cache_dir%/twig"
    charset:              "%kernel.charset%"
    debug:                "%kernel.debug%"
    strict_variables:     ~
    auto_reload:          ~
    optimizations:        ~
    date:
        format: d.m.Y, H:i:s
        interval_format: '%%d days'
        timezone: Europe/Paris
    number_format:
        decimals: 2
        decimal_point: ','
        thousands_separator: '.'
```|

Just a created a PR regarding this issue.

@manuonet the problem is not your config there, just as we a fix in this bundle code to work it on symfony 2.7

@linasm83 OK thanks a lot!
I always am questioning my work rather than the other ...

FIX with composer.phar update sonata-project/cache-bundle