GenreRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 24
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A findByTmdbIds() 0 8 1
A findAllWithTranslations() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Genres\Repository;
6
7
use App\Genres\Entity\Genre;
8
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
9
use Symfony\Bridge\Doctrine\RegistryInterface;
10
11
/**
12
 * @method Genre|null find($id, $lockMode = null, $lockVersion = null)
13
 * @method Genre|null findOneBy(array $criteria, array $orderBy = null)
14
 * @method Genre[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
15
 */
16
class GenreRepository extends ServiceEntityRepository
17
{
18 19
    public function __construct(RegistryInterface $registry)
19
    {
20 19
        parent::__construct($registry, Genre::class);
21 19
    }
22
23 2
    public function findByTmdbIds(array $ids)
24
    {
25 2
        return $this->createQueryBuilder('g')
26 2
            ->where('g.tmdbId IN (:ids)')
27 2
            ->setParameter('ids', $ids)
28 2
            ->getQuery()
29 2
            ->getResult();
30
    }
31
32 5
    public function findAllWithTranslations()
33
    {
34 5
        return $this->createQueryBuilder('g')
35 5
            ->leftJoin('g.translations', 'gt')
36 5
            ->addSelect('gt')
37 5
            ->orderBy('gt.name');
38
    }
39
}
40