From bf6c0346d8d35a719dd1bff1cb4d573d422f99ff Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 31 May 2017 09:31:18 +0200 Subject: WIP Signed-off-by: Thomas Citharel --- .../Repository/AccountRepository.php | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/Wallabag/FederationBundle/Repository/AccountRepository.php (limited to 'src/Wallabag/FederationBundle/Repository/AccountRepository.php') diff --git a/src/Wallabag/FederationBundle/Repository/AccountRepository.php b/src/Wallabag/FederationBundle/Repository/AccountRepository.php new file mode 100644 index 00000000..e39bc582 --- /dev/null +++ b/src/Wallabag/FederationBundle/Repository/AccountRepository.php @@ -0,0 +1,48 @@ +createQueryBuilder('a') + ->select('f.id, f.username') + ->innerJoin('a.following', 'f') + ->where('a.id = :accountId')->setParameter('accountId', $accountId) + ; + } + + /** + * @param $accountId + * @return QueryBuilder + */ + public function getBuilderForFollowersByAccount($accountId) + { + return $this->createQueryBuilder('a') + ->innerJoin('a.followers', 'f') + ->where('a.id = :accountId')->setParameter('accountId', $accountId) + ; + } + + /** + * @param $username + * @return QueryBuilder + * @throws \Doctrine\ORM\NonUniqueResultException + */ + public function findAccountByUsername($username) + { + return $this->createQueryBuilder('a') + ->where('a.username = :username')->setParameter('username', $username) + ->andWhere('a.server = null') + ->getQuery() + ->getOneOrNullResult(); + } +} -- cgit v1.2.3