- $export = new EntriesExport(array($entry));
- $export->setMethod('entry');
- $export->exportAs($format);
+ $method = ucfirst($category);
+ $methodBuilder = 'getBuilderFor'.$method.'ByUser';
+ $entries = $this->getDoctrine()
+ ->getRepository('WallabagCoreBundle:Entry')
+ ->$methodBuilder($this->getUser()->getId())
+ ->getQuery()
+ ->getResult();
+
+ try {
+ return $this->get('wallabag_core.helper.entries_export')
+ ->setEntries($entries)
+ ->updateTitle($method)
+ ->exportAs($format);
+ } catch (\InvalidArgumentException $e) {
+ throw new NotFoundHttpException($e->getMessage());
+ }