private function update(Note $note, ParameterBag $parameters) { $note->setTitle($parameters->get('title')); $note->setColor($parameters->get('color')); $note->setContent($parameters->get('content')); return $note; }
private function update(Note $note, array $payload) { $note->setTitle($payload['title']); $note->setColor($payload['color']); $note->setType($payload['type']); $note->setContent($payload['content']); return $note; }
/** * @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); }
/** * @Route("/note/{id}", name="note_update_note") * @Method("PUT") */ public function editNoteAction(Request $request, Note $oNote) { $oNote->setTitle($request->get('title')); $oNote->setContent($request->get('content')); $em = $this->getDoctrine()->getManager(); $em->persist($oNote); $em->flush(); $aNote = $this->get('serializer')->normalize($oNote); return new JsonResponse($aNote); }
/** * @Route("/note/{id}", name="note_edit") * @Method("PUT") */ public function editAction(Request $request, Note $note) { $newNote = json_decode($request->getContent()); $note->setTitle($newNote->title); $note->setContent($newNote->content); $entityManager = $this->getDoctrine()->getManager(); $entityManager->persist($note); $entityManager->flush(); return new JsonResponse([]); }
/** * @Route("/note/{id}", name="note_update") * @Method("PUT") */ public function updateAction(Request $request, Note $note) { $payload = json_decode($request->getContent(), true); $note->setTitle($request->get('title')); $note->setContent($request->get('content')); $em = $this->getDoctrine()->getManager(); $em->persist($note); $em->flush(); $noteNormalized = $this->get('serializer')->normalize($note); return new JsonResponse($noteNormalized); }
public function doLoad(ObjectManager $manager) { /** @var Label $label */ $label = $this->getReference(Label::class); $note = new Entity\Note(); $note->setTitle('Test Title'); $note->setColor('red'); $note->setType(Entity\Note::TYPE_TEXT); $note->setContent('Test Content'); $note->addLabel($label); $manager->persist($note); $this->setReference(static::class, $note); $manager->flush(); return [$note]; }
/** * {@inheritDoc} */ public function setTitle($title) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setTitle', [$title]); return parent::setTitle($title); }