]>
Commit | Line | Data |
---|---|---|
0c83fd59 J |
1 | <?php |
2 | ||
1210dae1 | 3 | namespace Wallabag\UserBundle\Repository; |
0c83fd59 J |
4 | |
5 | use Doctrine\ORM\EntityRepository; | |
6 | ||
7 | class UserRepository extends EntityRepository | |
8 | { | |
9 | /** | |
4346a860 | 10 | * Find a user by its username and rss roken. |
0c83fd59 J |
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 | } | |
625acf33 KG |
26 | |
27 | /** | |
28 | * Find a user by its username. | |
29 | * | |
30 | * @param string $username | |
31 | * | |
32 | * @return User | |
33 | */ | |
34 | public function findOneByUserName($username) | |
35 | { | |
36 | return $this->createQueryBuilder('u') | |
37 | ->andWhere('u.username = :username')->setParameter('username', $username) | |
38 | ->getQuery() | |
39 | ->getSingleResult(); | |
40 | } | |
0c83fd59 | 41 | } |