X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FRepository%2FEntryRepository.php;h=8f23164f7458c67efacc21da1808831d879f197c;hb=ee122a7528f55dfb5f02e351c509d00b756fedaa;hp=61be5220149771143f573aa27127fb461b9f9a6f;hpb=27dce581caba158a8ffffa5bc30648a21f47da12;p=github%2Fwallabag%2Fwallabag.git 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 @@ -85,6 +85,25 @@ class EntryRepository extends EntityRepository ; } + /** + * Retrieves entries filtered with a search term for a user. + * + * @param int $userId + * @param string $term + * + * @return QueryBuilder + */ + public function getBuilderForSearchByUser($userId, $term) + { + return $this + ->getBuilderByUser($userId) + ->andWhere('e.content LIKE :term')->setParameter('term', '%'.$term.'%') + ->orWhere('e.title LIKE :term')->setParameter('term', '%'.$term.'%') + ->leftJoin('e.tags', 't') + ->groupBy('e.id') + ->having('count(t.id) = 0'); + } + /** * Retrieves untagged entries for a user. *