Completed
Push — master ( 71eba9...1e1a94 )
by Valentyn
04:31
created

MovieCardRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 16
rs 10
c 0
b 0
f 0
ccs 9
cts 9
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A findAllByMovie() 0 8 1
1
<?php
2
3
namespace App\Movies\Repository;
4
5
use App\Movies\Entity\MovieCard;
6
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
7
use Doctrine\ORM\Query;
8
use Symfony\Bridge\Doctrine\RegistryInterface;
9
10
/**
11
 * @method MovieCard|null find($id, $lockMode = null, $lockVersion = null)
12
 * @method MovieCard|null findOneBy(array $criteria, array $orderBy = null)
13
 * @method MovieCard[]    findAll()
14
 * @method MovieCard[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
15
 */
16
class MovieCardRepository extends ServiceEntityRepository
17
{
18 1
    public function __construct(RegistryInterface $registry)
19
    {
20 1
        parent::__construct($registry, MovieCard::class);
21 1
    }
22
23 1
    public function findAllByMovie(string $locale, int $movieId): Query
24
    {
25 1
        return $this->createQueryBuilder('mc')
26 1
            ->where('mc.movie = :movieId AND mc.locale = :locale')
27 1
            ->setParameter('movieId', $movieId)
28 1
            ->setParameter('locale', $locale)
29 1
            ->getQuery();
30
    }
31
}
32