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

MovieActorRepository::findAllByActor()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 22

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 22
ccs 0
cts 17
cp 0
rs 9.568
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 6
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 3
    public function __construct(RegistryInterface $registry)
21
    {
22 3
        parent::__construct($registry, MovieActor::class);
23 3
    }
24
25 3
    public function findAllByMovie(int $movieId): Query
26
    {
27 3
        return $this->createQueryBuilder('ma')
28 3
            ->leftJoin('ma.actor', 'a')
29 3
            ->addSelect('a')
30 3
            ->leftJoin('a.translations', 'at')
31 3
            ->addSelect('at')
32 3
            ->where('ma.movie = :movieId')
33 3
            ->setParameter('movieId', $movieId)
34 3
            ->getQuery();
35
    }
36
}
37