Beispiel #1
0
 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_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);
 }
Beispiel #4
0
 /**
  * @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([]);
 }
Beispiel #5
0
 /**
  * @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);
 }
Beispiel #6
0
 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 setContent($content)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setContent', [$content]);
     return parent::setContent($content);
 }