diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/EntryRepository.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 4d45e5f5..e9351d85 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -92,12 +92,15 @@ class EntryRepository extends EntityRepository | |||
92 | * @param bool $isStarred | 92 | * @param bool $isStarred |
93 | * @param string $sort | 93 | * @param string $sort |
94 | * @param string $order | 94 | * @param string $order |
95 | * @param int $since | ||
96 | * @param string $tags | ||
95 | * | 97 | * |
96 | * @return array | 98 | * @return array |
97 | */ | 99 | */ |
98 | public function findEntries($userId, $isArchived = null, $isStarred = null, $sort = 'created', $order = 'ASC') | 100 | public function findEntries($userId, $isArchived = null, $isStarred = null, $sort = 'created', $order = 'ASC', $since = 0, $tags = '') |
99 | { | 101 | { |
100 | $qb = $this->createQueryBuilder('e') | 102 | $qb = $this->createQueryBuilder('e') |
103 | ->leftJoin('e.tags', 't') | ||
101 | ->where('e.user =:userId')->setParameter('userId', $userId); | 104 | ->where('e.user =:userId')->setParameter('userId', $userId); |
102 | 105 | ||
103 | if (null !== $isArchived) { | 106 | if (null !== $isArchived) { |
@@ -108,6 +111,16 @@ class EntryRepository extends EntityRepository | |||
108 | $qb->andWhere('e.isStarred =:isStarred')->setParameter('isStarred', (bool) $isStarred); | 111 | $qb->andWhere('e.isStarred =:isStarred')->setParameter('isStarred', (bool) $isStarred); |
109 | } | 112 | } |
110 | 113 | ||
114 | if ($since >= 0) { | ||
115 | $qb->andWhere('e.updatedAt > :since')->setParameter('since', new \DateTime(date('Y-m-d H:i:s', $since))); | ||
116 | } | ||
117 | |||
118 | if ('' !== $tags) { | ||
119 | foreach (explode(',', $tags) as $tag) { | ||
120 | $qb->andWhere('t.label = :label')->setParameter('label', $tag); | ||
121 | } | ||
122 | } | ||
123 | |||
111 | if ('created' === $sort) { | 124 | if ('created' === $sort) { |
112 | $qb->orderBy('e.id', $order); | 125 | $qb->orderBy('e.id', $order); |
113 | } elseif ('updated' === $sort) { | 126 | } elseif ('updated' === $sort) { |