|
@@ -39,7 +39,10 @@ class FilmRepository extends ServiceEntityRepository
|
|
|
->innerJoin('f.genres', 'g')
|
|
|
->addSelect('f');
|
|
|
|
|
|
- $qb->andWhere($qb->expr()->in('g.name', $genreNames));
|
|
|
+ $qb
|
|
|
+ ->andWhere($qb->expr()->in('g.name', ':genrenames'))
|
|
|
+ ->setParameter('genrenames', $genreNames)
|
|
|
+ ;
|
|
|
|
|
|
return $qb;
|
|
|
}
|
|
@@ -58,8 +61,9 @@ class FilmRepository extends ServiceEntityRepository
|
|
|
$qb
|
|
|
->leftJoin('f.realisateurs', 'rea')
|
|
|
->addSelect('f')
|
|
|
- ->andWhere($qb->expr()->in('rea.nomComplet', $realisateursNames));
|
|
|
-
|
|
|
+ ->andWhere($qb->expr()->in('rea.nomComplet', ':realisateurs'))
|
|
|
+ ->setParameter('realisateurs', $realisateursNames)
|
|
|
+ ;
|
|
|
return $qb;
|
|
|
}
|
|
|
|
|
@@ -176,4 +180,24 @@ class FilmRepository extends ServiceEntityRepository
|
|
|
->getResult()
|
|
|
;
|
|
|
}
|
|
|
+
|
|
|
+ public function findFilmInImdb(Film $film): array
|
|
|
+ {
|
|
|
+ $reals = [];
|
|
|
+ foreach($film->getRealisateurs() as $real) {
|
|
|
+ $reals[] = $real->getNomComplet();
|
|
|
+ }
|
|
|
+ $qb = $this->createQueryBuilder('f');
|
|
|
+ $qb
|
|
|
+ ->andWhere('f.titre = :titre')
|
|
|
+ ->setParameter('titre', $film->getTitre())
|
|
|
+ ->innerJoin('f.realisateurs', 'rea')
|
|
|
+ ->andWhere($qb->expr()->in('rea.nomComplet', ':reals'))
|
|
|
+ ->setParameter('reals', $reals)
|
|
|
+ ;
|
|
|
+ return $qb
|
|
|
+ ->getQuery()
|
|
|
+ ->getResult()
|
|
|
+ ;
|
|
|
+ }
|
|
|
}
|