3 namespace Wallabag\FederationBundle\Repository
;
5 use Doctrine\ORM\EntityRepository
;
6 use Doctrine\ORM\QueryBuilder
;
8 class AccountRepository
extends EntityRepository
12 * @return QueryBuilder
14 public function getBuilderForFollowingsByAccount($accountId)
16 return $this->createQueryBuilder('a')
17 ->select('f.id, f.username')
18 ->innerJoin('a.following', 'f')
19 ->where('a.id = :accountId')->setParameter('accountId', $accountId)
25 * @return QueryBuilder
27 public function getBuilderForFollowersByAccount($accountId)
29 return $this->createQueryBuilder('a')
30 ->innerJoin('a.followers', 'f')
31 ->where('a.id = :accountId')->setParameter('accountId', $accountId)
37 * @return QueryBuilder
38 * @throws \Doctrine\ORM\NonUniqueResultException
40 public function findAccountByUsername($username)
42 return $this->createQueryBuilder('a')
43 ->where('a.username = :username')->setParameter('username', $username)
44 ->andWhere('a.server = null')
46 ->getOneOrNullResult();