/**
  * Updates an annotation.
  *
  * @ApiDoc(
  *      requirements={
  *          {"name"="annotation", "dataType"="string", "requirement"="\w+", "description"="The annotation ID"}
  *      }
  * )
  *
  * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation")
  *
  * @return Response
  */
 public function putAnnotationAction(Annotation $annotation, Request $request)
 {
     $data = json_decode($request->getContent(), true);
     if (!is_null($data['text'])) {
         $annotation->setText($data['text']);
     }
     $em = $this->getDoctrine()->getManager();
     $em->flush();
     $json = $this->get('serializer')->serialize($annotation, 'json');
     return $this->renderJsonResponse($json);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $annotation1 = new Annotation($this->getReference('admin-user'));
     $annotation1->setEntry($this->getReference('entry1'));
     $annotation1->setText('This is my annotation /o/');
     $annotation1->setQuote('content');
     $manager->persist($annotation1);
     $this->addReference('annotation1', $annotation1);
     $annotation2 = new Annotation($this->getReference('admin-user'));
     $annotation2->setEntry($this->getReference('entry2'));
     $annotation2->setText('This is my 2nd annotation /o/');
     $annotation2->setQuote('content');
     $manager->persist($annotation2);
     $this->addReference('annotation2', $annotation2);
     $manager->flush();
 }