]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/Controller/RssController.php
Update deps
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / RssController.php
CommitLineData
0c83fd59
J
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,
371ac69a 28 $user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit')
0c83fd59
J
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,
371ac69a 52 $user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit')
0c83fd59
J
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,
371ac69a 76 $user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit')
0c83fd59
J
77 );
78
79 return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array(
80 'type' => 'starred',
81 'entries' => $entries,
82 ));
83 }
84}