Closed beleneglorion closed 9 years ago
I had the same issue, using $app>share as in http://silex.sensiolabs.org/doc/providers/twig.html#customization solves it without calling $twig->hasExtension:
if (isset($app['twig'])) {
$app['twig'] = $app->share($app->extend('twig', function($twig, $app) {
$twig->addExtension(new PagerfantaExtension($app));
return $twig;
}));
}
Sorry I totally forgot about this, can you send a PR with that solution? Thanks!
https://github.com/plotek/silex-pagerfanta-provider/compare/franmomu:master...master gives you the proper diff, see https://github.com/franmomu/silex-pagerfanta-provider/pull/8 for the pull-request
It was fixed in https://github.com/franmomu/silex-pagerfanta-provider/pull/7
When rendering multiple twig file in the same "controller" a LogicException is throw , you need to test if the extension il already loaded before add it