]> git.immae.eu Git - github/wallabag/wallabag.git/blame_incremental - src/Wallabag/UserBundle/Repository/UserRepository.php
Merge pull request #2010 from wallabag/set-title-via-post-api
[github/wallabag/wallabag.git] / src / Wallabag / UserBundle / Repository / UserRepository.php
... / ...
CommitLineData
1<?php
2
3namespace Wallabag\UserBundle\Repository;
4
5use Doctrine\ORM\EntityRepository;
6
7class 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
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 }
41}