setQuote() public method

Set quote.
public setQuote ( string $quote ) : Annotation
$quote string
return Annotation
Ejemplo n.º 1
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();
 }
 /**
  * Creates a new annotation.
  *
  * @param Entry $entry
  *
  * @ApiDoc(
  *      requirements={
  *          {"name"="ranges", "dataType"="array", "requirement"="\w+", "description"="The range array for the annotation"},
  *          {"name"="quote", "dataType"="string", "required"=false, "description"="Optional, quote for the annotation"},
  *          {"name"="text", "dataType"="string", "required"=true, "description"=""},
  *      }
  * )
  *
  * @return Response
  */
 public function postAnnotationAction(Request $request, Entry $entry)
 {
     $data = json_decode($request->getContent(), true);
     $em = $this->getDoctrine()->getManager();
     $annotation = new Annotation($this->getUser());
     $annotation->setText($data['text']);
     if (array_key_exists('quote', $data)) {
         $annotation->setQuote($data['quote']);
     }
     if (array_key_exists('ranges', $data)) {
         $annotation->setRanges($data['ranges']);
     }
     $annotation->setEntry($entry);
     $em->persist($annotation);
     $em->flush();
     $json = $this->get('serializer')->serialize($annotation, 'json');
     return $this->renderJsonResponse($json);
 }