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

MovieCardRepository::findAllByMovie()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
ccs 6
cts 6
cp 1
cc 1
nc 1
nop 2
crap 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