]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/GroupBundle/Repository/GroupRepository.php
WIP
[github/wallabag/wallabag.git] / src / Wallabag / GroupBundle / Repository / GroupRepository.php
CommitLineData
2041810a
TC
1<?php
2
3namespace Wallabag\GroupBundle\Repository;
4
5use Doctrine\ORM\EntityRepository;
6use Doctrine\ORM\QueryBuilder;
7use Wallabag\UserBundle\Entity\User;
8
9class GroupRepository extends EntityRepository
10{
11 /**
12 * Return a query builder to used by other getBuilderFor* method.
13 *
14 * @return QueryBuilder
15 */
16 public function getBuilder()
17 {
18 return $this->createQueryBuilder('g');
19 }
20
21 public function findPublicGroups()
22 {
23 return $this->getBuilder()
24 ->where('g.acceptSystem < 10');
25 }
26
27 public function findGroupsByUser(User $user)
28 {
29 return $this->getBuilder()
30 ->join('Wallabag\GroupBundle\Entity\UserGroup', 'u', 'WITH', 'u.group = g.id')
31 ->where('u.user = :user')->setParameter(':user', $user->getId());
32 }
33}