diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository')
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/EntryRepository.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 61be5220..8f23164f 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -86,6 +86,25 @@ 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 | * | ||
94 | * @return QueryBuilder | ||
95 | */ | ||
96 | public function getBuilderForSearchByUser($userId, $term) | ||
97 | { | ||
98 | return $this | ||
99 | ->getBuilderByUser($userId) | ||
100 | ->andWhere('e.content LIKE :term')->setParameter('term', '%'.$term.'%') | ||
101 | ->orWhere('e.title LIKE :term')->setParameter('term', '%'.$term.'%') | ||
102 | ->leftJoin('e.tags', 't') | ||
103 | ->groupBy('e.id') | ||
104 | ->having('count(t.id) = 0'); | ||
105 | } | ||
106 | |||
107 | /** | ||
89 | * Retrieves untagged entries for a user. | 108 | * Retrieves untagged entries for a user. |
90 | * | 109 | * |
91 | * @param int $userId | 110 | * @param int $userId |