Ejemplo n.º 1
0
 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];
 }
Ejemplo n.º 2
0
 /**
  * @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);
 }
Ejemplo n.º 3
0
 private function update(Label $label, array $payload)
 {
     $label->setName($payload['name']);
 }