I have a route like this:
/**
* @Route("/admin/user/edit/{id}", defaults={"id" = 0}, name="admin_user_edit")
* @Route("/admin/user/edit")
*
*/
public function editAction(Request $request, $id = 0){
(...)
And then a Twig template, where I list all users:
{% for user in users %}
<li>
<a href='{{ path('admin_user_edit'),{'id' : user.getId()} }}'>
{{ user.getUsername() }}
</a>
</li>
{% endfor %}
As you can see I'm trying to pass the 'user.getId()' as an id. And I get this:
Unexpected token "punctuation" of value "," ("end of print statement" expected) in admin/users/list.html.twig at line 5.
I know it's about this user.getId() because everything was fine before I added this piece of code.
So how can I pass a function result to this "path" function?