public function updateSubTopicAction(Request $request ,$id) {
$updatesubtopic = $this->getDoctrine()
->getRepository('FeedbackBundle:Subtopics')
->findASubtopics($id);
//print_r($updatesubtopic);die;
if ($request->getMethod() == 'POST') {
$update = $request->request->all();
//print_r($update);die;
$updatesubtopic->setTopic($update['Topicname']);
$updatesubtopic->setName($update['subtopicname']);
$updatesubtopic->setDetails($update['subtopicdetails']);
//print_r($updatesubtopic);die;
$em = $this->getDoctrine()->getManager();
$em->persist($updatesubtopic);
$em->flush();
return new RedirectResponse($this-generateUrl('view_topic'));
}
return $this-render(
'FeedbackBundle:SubTopic:update_sub_topic.html.php',
array('updatesubtopic'=>$updatesubtopic)
);
}
如何更新数据?