]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/UserBundle/Repository/UserRepository.php
Added check if there is only one user
[github/wallabag/wallabag.git] / src / Wallabag / UserBundle / Repository / UserRepository.php
index 009c4881d0ea8945379e159894f00b4ca51a1f2d..178761e6da32ff4e3f758290f5d72c8688890946 100644 (file)
@@ -38,4 +38,18 @@ class UserRepository extends EntityRepository
             ->getQuery()
             ->getSingleResult();
     }
+
+    /**
+     * Count how many users are enabled.
+     *
+     * @return int
+     */
+    public function getSumEnabledUsers()
+    {
+        return $this->createQueryBuilder('u')
+            ->select('count(u)')
+            ->andWhere('u.expired = 0')
+            ->getQuery()
+            ->getSingleScalarResult();
+    }
 }