Passed
Push — master ( ee4256...c7999a )
by Julito
08:50
created

ExtraFieldRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getExtraFields() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Repository;
8
9
use Chamilo\CoreBundle\Entity\ExtraField;
10
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
11
use Doctrine\Persistence\ManagerRegistry;
12
13
class ExtraFieldRepository extends ServiceEntityRepository
14
{
15
    public function __construct(ManagerRegistry $registry)
16
    {
17
        parent::__construct($registry, ExtraField::class);
18
    }
19
20
    /**
21
     * @return ExtraField[]
22
     */
23
    public function getExtraFields()
24
    {
25
        $qb = $this->createQueryBuilder('f');
26
        $qb
27
            ->where(
28
                $qb->expr()->andX(
29
                    $qb->expr()->eq('f.visibleToSelf', true)
30
                )
31
            )
32
        ;
33
34
        return $qb->getQuery()->getResult();
35
    }
36
}
37