2014-06-24 50 views

回答

9

在樹枝模板

<a href="{{ path('delete_route_name', {'id': entity.id }) }}">Delete</a> 

在您的控制器

/** 
* @param User $entity 
* 
* @Route("/{id}/entity-remove", requirements={"id" = "\d+"}, name="delete_route_name") 
* @return RedirectResponse 
* 
*/ 
public function deleteActionName(User $entity) 
... 
+0

感謝更多小菜友好的回答;) – JustAJavaProgrammer