Description
Starting from Symfony 2.7 the global Twig variable app
is from type Symfony\Bridge\Twig\AppVariable
instead of Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables
.
This did not made any problem, since until Sf 3.2 the methods of both classes are the same. But starting from Sf 3.3 there will be a method called getFlashes
(see symfony/symfony#21819) which is only defined in AppVariable
.
Since the AppVariable
class only exists since Sf 2.7, the best solution would be to (dynamically) read the configuration from src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
and find the actual class of app
variable:
References:
https://github.com/symfony/symfony/blob/2.6/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
https://github.com/symfony/symfony/blob/2.7/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml