EmanueleMinotto / TwigCacheBundle

Symfony Bundle for asm89/twig-cache-extension
59 stars 13 forks source link

ProfilerExtension does not work with newest twig version #19

Closed Bruce17 closed 5 years ago

Bruce17 commented 6 years ago

Hi,

I currently updated to the latest twig version v1.35.0 and now the toolbar icon does not show any more. It seems the method getName() now should return a FQCN over a simple string. This breaks the profiler from loading.

By replacing the following code at the end of TwigCacheBundle\DependencyInjection\TwigCacheExtension, I'll get the toolbar icon back again, but profiling still does not work:

if ($config['profiler']) {
    $container->setParameter('twig_cache.extension.class', ProfilerExtension::class);

    if (version_compare(\Twig_Environment::VERSION, '1.26.0', '>=')) {
        $extensionId = 'TwigCacheBundle\Twig\ProfilerExtension';
    } else {
        $extensionId = 'asm89_cache';
    }

    $container->getDefinition('twig_cache.extension')->addTag('data_collector', [
        'id'       => extensionId,
        'template' => 'TwigCacheBundle:Collector:asm89_cache',
    ]);
}

Any idea what is missing to get the toolbar icon and profiler back running?

toooni commented 6 years ago

Hi @Bruce17 I've made a PR (https://github.com/EmanueleMinotto/TwigCacheBundle/pull/22) which solves this issue. Can you take a look at it?

toooni commented 6 years ago

@Bruce17 @n3o77 @mikemix Can someone of you guys review #22?

muspelheim commented 6 years ago

@toooni i reviewed. approved

Blackskyliner commented 5 years ago

Could be closed then I guess?