aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/WallabagBundle/Controller/EntryController.php
blob: 233a6c32bcf37946368eaf570e78e69023c24680 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php

namespace WallabagBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use WallabagBundle\Repository;

class EntryController extends Controller
{
    /**
     * @Route("/unread", name="unread")
     */
    public function showUnreadAction()
    {
        $repository = $this->getDoctrine()->getRepository('WallabagBundle:Entries');
        $entries = $repository->findUnreadByUser(1);

        return $this->render(
            'WallabagBundle:Entry:entries.html.twig',
            array('entries' => $entries)
        );

    }

    /**
     * @Route("/archive", name="archive")
     */
    public function showArchiveAction()
    {
        $repository = $this->getDoctrine()->getRepository('WallabagBundle:Entries');
        $entries = $repository->findArchiveByUser(1);

        return $this->render(
            'WallabagBundle:Entry:entries.html.twig',
            array('entries' => $entries)
        );

    }

    /**
     * @Route("/starred", name="starred")
     */
    public function showStarredAction()
    {
        $repository = $this->getDoctrine()->getRepository('WallabagBundle:Entries');
        $entries = $repository->findStarredByUser(1);

        return $this->render(
            'WallabagBundle:Entry:entries.html.twig',
            array('entries' => $entries)
        );

    }

    /**
     * @Route("/view/{id}", requirements={"id" = "\d+"}, name="view")
     */
    public function viewAction($id)
    {
        $repository = $this->getDoctrine()->getRepository('WallabagBundle:Entries');
        $entry = $repository->find($id);

        return $this->render(
            'WallabagBundle:Entry:entry.html.twig',
            array('entry' => $entry)
        );

    }
}