Completed
Push — master ( 856e20...90d449 )
by Jan
04:33
created

UserRepository::getAnonymousUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Repository;
4
5
use App\Entity\UserSystem\User;
6
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
7
use Symfony\Bridge\Doctrine\RegistryInterface;
8
9
/**
10
 * @method User|null find($id, $lockMode = null, $lockVersion = null)
11
 * @method User|null findOneBy(array $criteria, array $orderBy = null)
12
 * @method User[]    findAll()
13
 * @method User[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
14
 */
15
class UserRepository extends ServiceEntityRepository
16
{
17
    public function __construct(RegistryInterface $registry)
18
    {
19
        parent::__construct($registry, User::class);
20
    }
21
22
    /**
23
     * Returns the anonymous user
24
     * @return User|null
25
     */
26
    public function getAnonymousUser()
27
    {
28
        return $this->findOneBy([
29
                'id' => User::ID_ANONYMOUS
30
            ]);
31
    }
32
33
    // /**
34
    //  * @return User[] Returns an array of User objects
35
    //  */
36
    /*
37
    public function findByExampleField($value)
38
    {
39
        return $this->createQueryBuilder('u')
40
            ->andWhere('u.exampleField = :val')
41
            ->setParameter('val', $value)
42
            ->orderBy('u.id', 'ASC')
43
            ->setMaxResults(10)
44
            ->getQuery()
45
            ->getResult()
46
        ;
47
    }
48
    */
49
50
    /*
51
    public function findOneBySomeField($value): ?User
52
    {
53
        return $this->createQueryBuilder('u')
54
            ->andWhere('u.exampleField = :val')
55
            ->setParameter('val', $value)
56
            ->getQuery()
57
            ->getOneOrNullResult()
58
        ;
59
    }
60
    */
61
}
62