Passed
Push — master ( 76abd2...ab5d59 )
by Julito
10:01
created

LanguageRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CoreBundle\Repository;
5
6
use Chamilo\CoreBundle\Entity\Language;
7
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
8
use Doctrine\Common\Persistence\ManagerRegistry;
9
10
/**
11
 * Class LanguageRepository.
12
 *
13
 * @package Chamilo\CoreBundle\Repository
14
 */
15
class LanguageRepository extends ServiceEntityRepository
16
{
17
    /**
18
     * LanguageRepository constructor.
19
     *
20
     * @param ManagerRegistry $registry
21
     */
22
    public function __construct(ManagerRegistry $registry)
23
    {
24
        parent::__construct($registry, Language::class);
25
    }
26
27
    /**
28
     * Get all the sub languages that are made available by the admin.
29
     *
30
     * @return array
31
     */
32
    public function findAllPlatformSubLanguages()
33
    {
34
        $qb = $this->createQueryBuilder('l');
35
        $qb->select('l')
36
            ->where(
37
                $qb->expr()->eq('l.available', true)
38
            )
39
            ->andWhere(
40
                $qb->expr()->isNotNull('l.parent')
41
            );
42
43
        return $qb->getQuery()->getResult();
44
    }
45
}
46