Symfony 2 - missing mandatory parameters exception on twig extends -


i'm getting wired twig exception:

if use twig {% extends 'some:template' %}, following twig exception:

an exception has been thrown during rendering of template ("the "_projectview" route has missing mandatory parameters ("id").") in "xy:project:view.html.twig". 

but if remove {% extends 'some:template' %}, template displayed correctly - part rules out problems routing or controller, has problem template can't figure out. no variables used in parent templates.

inside template you're trying extend you're trying generate url route '_projectview' don't provide necessary parameters.

either add default id route ...

route_name:     pattern: /whatever/{id}     defaults: { id: 1 } 

... or in template:

{{ path('route', { 'id' : entity.id|default('1') }) }} 

Comments