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