/**
  * delete stock entity from the product detail table
  * @Route("/delete_stock_2/{id}",name="deletestock2")
  * @ParamConverter("stock", class="AppBundle:Stock")
  */
 public function delete_stock_2(Stock $stock)
 {
     $user_id = $stock->getUser()->getId();
     $em = $this->getDoctrine()->getManager();
     $em->remove($stock);
     $em->flush();
     echo "<script>alert('删除成功!')</script>";
     return $this->redirectToRoute('productdetail', array('id' => $user_id));
 }