/** * Retrieve annotations for an entry. * * @ApiDoc( * requirements={ * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} * } * ) * * @return Response */ public function getAnnotationsAction(Entry $entry) { $annotationRows = $this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->findAnnotationsByPageId($entry->getId(), $this->getUser()->getId()); $total = count($annotationRows); $annotations = ['total' => $total, 'rows' => $annotationRows]; $json = $this->get('serializer')->serialize($annotations, 'json'); return $this->renderJsonResponse($json); }