symfony2 - symfony reload page after deleting item -
i have item on page , delete button in front end of each item, want delete , reload same page. far, go page, want avoid that:
i don't want go "skilllearndelete/{id}" page, want reload after deleting
here controller :
public function deleteaction($id) { $em = $this->getdoctrine()->getmanager(); $entity = $em->getrepository('eotouserbundle:userlearnskill')->find($id); if (!$entity) { throw $this->createnotfoundexception('unable find userlearnskill entity.'); } $em->remove($entity); $em->flush(); homecoming $this->render("eotouserbundle:learnskill:delete.html.twig",array('id' => $id)); }
here route:
userlearnskill_delete: path: skilllearndelete/{id} defaults: { _controller: eotouserbundle:userlearnskill:delete }
here page display items :
<td><a href="{{ path('userlearnskill_delete', { 'id': skill.id }) }} " onclick="return confirm('do want delete {{ skill.learnskill}} skill ?')"><span class="glyphicon glyphicon-remove remove-item"></span></a>
this typically accomplished returning redirect previous page after delete operation. part, user see page reload unless there uncaught exception.
in delete action:
return $this->redirect($this->generateurl('routename_to_my_original_page'));
symfony2
No comments:
Post a Comment