]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/UserBundle/Repository/UserRepository.php
Add a real configuration for CS-Fixer
[github/wallabag/wallabag.git] / src / Wallabag / UserBundle / Repository / UserRepository.php
index 445edb3c1077cb2826e2937cb7fccdff2ae4e2be..b1d753d2f42e97d2b1e016f45a87cc5ee546ec61 100644 (file)
@@ -48,8 +48,21 @@ class UserRepository extends EntityRepository
     {
         return $this->createQueryBuilder('u')
             ->select('count(u)')
-            ->andWhere('u.expired = false')
+            ->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 . '%');
+    }
 }