aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Controller/RssController.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-04-01 21:08:56 +0200
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-04-01 21:08:56 +0200
commit1a93ee423b072ec3bcb0c437cbf9b488bdea245c (patch)
tree1466dcb1b465f9ead71c4dcbefe380853c5d846b /src/Wallabag/CoreBundle/Controller/RssController.php
parentf98a2a0fc3ae8a5955bb811f083c3d2535f96791 (diff)
parent7d74a2f32b55fa9c33f5ecff57785e8d9e4de8ae (diff)
downloadwallabag-1a93ee423b072ec3bcb0c437cbf9b488bdea245c.tar.gz
wallabag-1a93ee423b072ec3bcb0c437cbf9b488bdea245c.tar.zst
wallabag-1a93ee423b072ec3bcb0c437cbf9b488bdea245c.zip
Merge pull request #1166 from wallabag/v2-rss
Add RSS feeds
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/RssController.php')
-rw-r--r--src/Wallabag/CoreBundle/Controller/RssController.php84
1 files changed, 84 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/RssController.php b/src/Wallabag/CoreBundle/Controller/RssController.php
new file mode 100644
index 00000000..14f1dcb2
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Controller/RssController.php
@@ -0,0 +1,84 @@
1<?php
2
3namespace Wallabag\CoreBundle\Controller;
4
5use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
7use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8use Wallabag\CoreBundle\Entity\User;
9use Wallabag\CoreBundle\Entity\Entry;
10
11class RssController extends Controller
12{
13 /**
14 * Shows unread entries for current user
15 *
16 * @Route("/{username}/{token}/unread.xml", name="unread_rss", defaults={"_format"="xml"})
17 * @ParamConverter("user", class="WallabagCoreBundle:User", converter="username_rsstoken_converter")
18 *
19 * @return \Symfony\Component\HttpFoundation\Response
20 */
21 public function showUnreadAction(User $user)
22 {
23 $entries = $this->getDoctrine()
24 ->getRepository('WallabagCoreBundle:Entry')
25 ->findUnreadByUser(
26 $user->getId(),
27 0,
28 $user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit')
29 );
30
31 return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array(
32 'type' => 'unread',
33 'entries' => $entries,
34 ));
35 }
36
37 /**
38 * Shows read entries for current user
39 *
40 * @Route("/{username}/{token}/archive.xml", name="archive_rss")
41 * @ParamConverter("user", class="WallabagCoreBundle:User", converter="username_rsstoken_converter")
42 *
43 * @return \Symfony\Component\HttpFoundation\Response
44 */
45 public function showArchiveAction(User $user)
46 {
47 $entries = $this->getDoctrine()
48 ->getRepository('WallabagCoreBundle:Entry')
49 ->findArchiveByUser(
50 $user->getId(),
51 0,
52 $user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit')
53 );
54
55 return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array(
56 'type' => 'archive',
57 'entries' => $entries,
58 ));
59 }
60
61 /**
62 * Shows starred entries for current user
63 *
64 * @Route("/{username}/{token}/starred.xml", name="starred_rss")
65 * @ParamConverter("user", class="WallabagCoreBundle:User", converter="username_rsstoken_converter")
66 *
67 * @return \Symfony\Component\HttpFoundation\Response
68 */
69 public function showStarredAction(User $user)
70 {
71 $entries = $this->getDoctrine()
72 ->getRepository('WallabagCoreBundle:Entry')
73 ->findStarredByUser(
74 $user->getId(),
75 0,
76 $user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit')
77 );
78
79 return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array(
80 'type' => 'starred',
81 'entries' => $entries,
82 ));
83 }
84}