aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/WallabagBundle/Repository
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-01-23 16:28:37 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-01-23 16:28:37 +0100
commitad4d1caa9e744af57ca58a4e57576533eb682d00 (patch)
tree37d6c284d2afc7fc62cdf80be419b536ab4ea603 /src/WallabagBundle/Repository
parentb84a80559a1167b5500fbc5eb4965d3b08b371ef (diff)
downloadwallabag-ad4d1caa9e744af57ca58a4e57576533eb682d00.tar.gz
wallabag-ad4d1caa9e744af57ca58a4e57576533eb682d00.tar.zst
wallabag-ad4d1caa9e744af57ca58a4e57576533eb682d00.zip
move WallabagBundle into Wallabag:CoreBundle
Diffstat (limited to 'src/WallabagBundle/Repository')
-rw-r--r--src/WallabagBundle/Repository/EntriesRepository.php79
1 files changed, 0 insertions, 79 deletions
diff --git a/src/WallabagBundle/Repository/EntriesRepository.php b/src/WallabagBundle/Repository/EntriesRepository.php
deleted file mode 100644
index 3eb1733d..00000000
--- a/src/WallabagBundle/Repository/EntriesRepository.php
+++ /dev/null
@@ -1,79 +0,0 @@
1<?php
2
3namespace WallabagBundle\Repository;
4
5use Doctrine\ORM\Query;
6use Doctrine\ORM\EntityRepository;
7use Doctrine\ORM\Tools\Pagination\Paginator;
8
9class EntriesRepository extends EntityRepository
10{
11 /**
12 * Retrieves unread entries for a user
13 *
14 * @param $userId
15 * @param $firstResult
16 * @param int $maxResults
17 * @return Paginator
18 */
19 public function findUnreadByUser($userId, $firstResult, $maxResults = 12)
20 {
21 $qb = $this->createQueryBuilder('e')
22 ->select('e')
23 ->setFirstResult($firstResult)
24 ->setMaxResults($maxResults)
25 ->where('e.isRead = 0')
26 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
27 ->getQuery();
28
29 $paginator = new Paginator($qb);
30
31 return $paginator;
32 }
33
34 /**
35 * Retrieves read entries for a user
36 *
37 * @param $userId
38 * @param $firstResult
39 * @param int $maxResults
40 * @return Paginator
41 */
42 public function findArchiveByUser($userId, $firstResult, $maxResults = 12)
43 {
44 $qb = $this->createQueryBuilder('e')
45 ->select('e')
46 ->setFirstResult($firstResult)
47 ->setMaxResults($maxResults)
48 ->where('e.isRead = 1')
49 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
50 ->getQuery();
51
52 $paginator = new Paginator($qb);
53
54 return $paginator;
55 }
56
57 /**
58 * Retrieves starred entries for a user
59 *
60 * @param $userId
61 * @param $firstResult
62 * @param int $maxResults
63 * @return Paginator
64 */
65 public function findStarredByUser($userId, $firstResult, $maxResults = 12)
66 {
67 $qb = $this->createQueryBuilder('e')
68 ->select('e')
69 ->setFirstResult($firstResult)
70 ->setMaxResults($maxResults)
71 ->where('e.isFav = 1')
72 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
73 ->getQuery();
74
75 $paginator = new Paginator($qb);
76
77 return $paginator;
78 }
79}