aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository/EntryRepository.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index 61be5220..47e24d6b 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -86,6 +86,36 @@ class EntryRepository extends EntityRepository
86 } 86 }
87 87
88 /** 88 /**
89 * Retrieves entries filtered with a search term for a user.
90 *
91 * @param int $userId
92 * @param string $term
93 * @param strint $currentRoute
94 *
95 * @return QueryBuilder
96 */
97 public function getBuilderForSearchByUser($userId, $term, $currentRoute)
98 {
99 $qb = $this
100 ->getBuilderByUser($userId);
101
102 if ('starred' === $currentRoute) {
103 $qb->andWhere('e.isStarred = true');
104 } elseif ('unread' === $currentRoute) {
105 $qb->andWhere('e.isArchived = false');
106 } elseif ('archive' === $currentRoute) {
107 $qb->andWhere('e.isArchived = true');
108 }
109
110 $qb
111 ->andWhere('e.content LIKE :term OR e.title LIKE :term')->setParameter('term', '%'.$term.'%')
112 ->leftJoin('e.tags', 't')
113 ->groupBy('e.id');
114
115 return $qb;
116 }
117
118 /**
89 * Retrieves untagged entries for a user. 119 * Retrieves untagged entries for a user.
90 * 120 *
91 * @param int $userId 121 * @param int $userId