I have a trouble with a symfony exeption and some parameter i try to get. I have absolutely no idea why i get this exception after thousands checks of my code and on the internet.
The exception is :
An exception has been thrown during the rendering of a template ("Some mandatory parameters are missing ("slug") to generate a URL for route "blogcomment_create".") in @Blog\Default\Blog\singlePost.html.twig at line 29.
The route configuration :
blogcomment_create:
path: /{slug}/comment/create/
defaults: { _controller: "BlogBundle:Comment:create" }
requirements: { methods: post }
My code in my twig template to import my controller:
<footer>
{{ render(controller('BlogBundle:Comment:create', {
'slug': Post.slugname
})) }}
</footer>
My Action declaration :
public function createAction(Request $request, $slug = null)
{
//...
}
I starting to get mad with this exception, i have no clues why i get her and i realy need a good pair of eyes.
i try tons of exemples :
How to insert a Controller in Twig with "render" in Symfony 2.2?
symfony2 - twig - how to render a twig template from inside a twig template
Change template via parameter when render a controller action?
...
Here a dump of the fonction :
object(Symfony\Component\HttpKernel\Controller\ControllerReference)[992]
public 'controller' =>
string 'BlogBundle:Comment:create' (length=31)
public 'attributes' =>
array (size=1)
'slug' => string 'article-de-test-yolowowo' (length=24)
public 'query' =>
array (size=0)
empty