public function doLoad(ObjectManager $manager) { $note = new Entity\Note\Label(); $note->setName('Test Label'); $manager->persist($note); $this->setReference(static::class, $note); $manager->flush(); return [$note]; }
/** * @Route("/note/label/{id}", name="note_label_update") * @Method("PUT") */ public function updateAction(Request $request, Note\Label $label) { $label->setName($request->get('name')); /** @var EntityManager $em */ $em = $this->getDoctrine()->getManager(); $em->persist($label); $em->flush(); $labelNormalized = $this->get('serializer')->normalize($label); return new JsonResponse($labelNormalized); }
private function update(Label $label, array $payload) { $label->setName($payload['name']); }