I'm struggeling to find an answer on following question.
How can i transfer Variables with the POST-Method by using Twig's path() function in a Symfony2 project. Or: How can I define the Method in the path() function.
Controller:
/**
* @Route('_route', name='_route')
* @Method ????
*/
public function pageAction(){ ... }
Twig:
{{ path('_route', {'slug': slug, 'POST-VARIABLE' : value}) }}
Thank you for your help!!
There is no way to create a POST
request in twig.
You can only create a url (that can contain GET query-parameters) using the path
function.
You could create a <form>
with method="POST"
that a user can click though.