I recently migrated my Silex v1.3 project where everything is worked fine, to the Silex v2. I get a twig error where I don't understand the cause
Twig_Error_Runtime in Template.php line 590:
Neither the property "request" nor one of the methods "request()", "getrequest()"/"isrequest()" or "__call()" exist and have public access in class "Silex\Application" in "index.twig" at line 5
Here is the 5 first lines of my index.twig file
{% extends "layout.twig" %}
{% block stylsheets %}
<link rel="stylesheet" type="text/css" href="{{ app.request.basepath }}/public/libs/odometer/themes/odometer-theme-minimal.css" />
And of course in the layout, I call the
{% block stylsheets %}{% endblock %}
But I'm not sure at all, the problem is on the twig file... Is something has to be change ?
Here is an extract of the controller:
$app->get('/', function () use ($app) {
return $app['twig']->render('index.twig', [
...
]);
})->bind('homepage');
Thanks for help
I found out that app.request.uri
wasn't working anymore with recent Twig.
But if you use global.request.uri
it works fine.
I did not find any information in Twig's documentation about that.