/** * @Post("/boats/add") * @RequestParam(name="name") * @RequestParam(name="category") * @View() */ public function addBoatAction($name, $category, $record = 0, $payment = false, $valid = false) { $em = $this->getDoctrine()->getManager(); $boat = new Boat(); $boat->setName($name); $boat->setCategory($category); $boat->setRecord($record); $boat->setPayment($payment); $boat->setValid($valid); $em->persist($boat); $em->flush(); return $boat; }
/** * @Post("/boats/catupdate/{boat}") * @ParamConverter("boat", class="Xaj\ErgoBundle\Entity\Boat", options={"id" = "boat"}) * @RequestParam(name="category") * @View() */ public function updateCategoryBoatAction(Boat $boat, $category) { $em = $this->getDoctrine()->getManager(); $firstCat = substr($boat->getCategory(), 0, 3); $boat->setCategory($firstCat . $category); $em->persist($boat); $em->flush(); return $boat; }