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