/** * @Route("/note/{id}", name="note_update") * @Method("PUT") */ public function updateAction(Request $request, Note $note) { $note->setTitle($request->get('title')); $note->setText($request->get('text')); $em = $this->getDoctrine()->getManager(); $em->persist($note); $em->flush(); $noteNormalized = $this->get('serializer')->normalize($note); return new JsonResponse($noteNormalized); }