X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FUserBundle%2FRepository%2FUserRepository.php;h=6adbe329fb5519f9308be0aafc39968451ad8f88;hb=822c877949aff8ae57677671115f8f4fc69588d5;hp=178761e6da32ff4e3f758290f5d72c8688890946;hpb=bb0c78f4a636fcc8f60dd3b42ad733e7f31e0bb4;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/UserBundle/Repository/UserRepository.php b/src/Wallabag/UserBundle/Repository/UserRepository.php index 178761e6..6adbe329 100644 --- a/src/Wallabag/UserBundle/Repository/UserRepository.php +++ b/src/Wallabag/UserBundle/Repository/UserRepository.php @@ -48,8 +48,21 @@ class UserRepository extends EntityRepository { return $this->createQueryBuilder('u') ->select('count(u)') - ->andWhere('u.expired = 0') + ->andWhere('u.enabled = true') ->getQuery() ->getSingleScalarResult(); } + + /** + * Retrieves users filtered with a search term. + * + * @param string $term + * + * @return QueryBuilder + */ + public function getQueryBuilderForSearch($term) + { + return $this->createQueryBuilder('u') + ->andWhere('lower(u.username) LIKE lower(:term) OR lower(u.email) LIKE lower(:term) OR lower(u.name) LIKE lower(:term)')->setParameter('term', '%'.$term.'%'); + } }