/** * @Route("/behalf/{id}/update", requirements={"id" = "\d+"}, name="admin_goods_behalflize") * @ParamConverter("product", class="WoojinGoodsBundle:GoodsPassport") * @Method("PUT") */ public function toBehalfAction(Request $request, GoodsPassport $product) { if (!$this->get('security.csrf.token_manager')->isCsrfTokenValid('to_behalf', $request->request->get('_token'))) { throw new AccessDeniedHttpException('Invalid CSRF token.'); } $em = $this->getDoctrine()->getManager(); $product->setStatus($em->find('WoojinGoodsBundle:GoodsStatus', Avenue::GS_BEHALF))->setIsBehalf(true); $em->persist($product); $em->flush(); return $this->redirect($this->generateUrl('goods_edit_v2', array('id' => $product->getId()))); }