3 namespace Wallabag\UserBundle\Repository
;
5 use Doctrine\ORM\EntityRepository
;
7 class UserRepository
extends EntityRepository
10 * Find a user by its username and rss roken.
12 * @param string $username
13 * @param string $rssToken
17 public function findOneByUsernameAndRsstoken($username, $rssToken)
19 return $this->createQueryBuilder('u')
20 ->leftJoin('u.config', 'c')
21 ->where('c.rssToken = :rss_token')->setParameter('rss_token', $rssToken)
22 ->andWhere('u.username = :username')->setParameter('username', $username)
24 ->getOneOrNullResult();
28 * Find a user by its username.
30 * @param string $username
34 public function findOneByUserName($username)
36 return $this->createQueryBuilder('u')
37 ->andWhere('u.username = :username')->setParameter('username', $username)
43 * Count how many users are enabled.
47 public function getSumEnabledUsers()
49 return $this->createQueryBuilder('u')
51 ->andWhere('u.expired = false')
53 ->getSingleScalarResult();