diff options
Diffstat (limited to 'src/Wallabag/UserBundle/Repository')
-rw-r--r-- | src/Wallabag/UserBundle/Repository/UserRepository.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Wallabag/UserBundle/Repository/UserRepository.php b/src/Wallabag/UserBundle/Repository/UserRepository.php new file mode 100644 index 00000000..c020f3ca --- /dev/null +++ b/src/Wallabag/UserBundle/Repository/UserRepository.php | |||
@@ -0,0 +1,26 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\UserBundle\Repository; | ||
4 | |||
5 | use Doctrine\ORM\EntityRepository; | ||
6 | |||
7 | class UserRepository extends EntityRepository | ||
8 | { | ||
9 | /** | ||
10 | * Find a user by its username and rss roken. | ||
11 | * | ||
12 | * @param string $username | ||
13 | * @param string $rssToken | ||
14 | * | ||
15 | * @return User|null | ||
16 | */ | ||
17 | public function findOneByUsernameAndRsstoken($username, $rssToken) | ||
18 | { | ||
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) | ||
23 | ->getQuery() | ||
24 | ->getOneOrNullResult(); | ||
25 | } | ||
26 | } | ||