Completed
Push — master ( b4d909...e3c084 )
by Valentyn
03:37
created

MovieActorRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Movies\Repository;
6
7
use App\Movies\Entity\MovieActor;
8
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
9
use Doctrine\ORM\Query;
10
use Symfony\Bridge\Doctrine\RegistryInterface;
11
12
/**
13
 * @method MovieActor|null find($id, $lockMode = null, $lockVersion = null)
14
 * @method MovieActor|null findOneBy(array $criteria, array $orderBy = null)
15
 * @method MovieActor[]    findAll()
16
 * @method MovieActor[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
17
 */
18
class MovieActorRepository extends ServiceEntityRepository
19
{
20 1
    public function __construct(RegistryInterface $registry)
21
    {
22 1
        parent::__construct($registry, MovieActor::class);
23 1
    }
24
25 1
    public function findAllByMovie(int $movieId): Query
26
    {
27 1
        return $this->createQueryBuilder('ma')
28 1
            ->leftJoin('ma.actor', 'a')
29 1
            ->addSelect('a')
30 1
            ->where('ma.movie = :movieId')
31 1
            ->setParameter('movieId', $movieId)
32 1
            ->getQuery();
33
    }
34
}
35