|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
namespace App\Service;
|
|
namespace App\Service;
|
|
|
|
|
|
|
|
|
|
+use App\Entity\Film;
|
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
|
use App\Repository\FilmRepository;
|
|
use App\Repository\FilmRepository;
|
|
|
|
|
|
|
@@ -10,21 +11,16 @@ use App\Repository\FilmRepository;
|
|
|
*/
|
|
*/
|
|
|
class Search
|
|
class Search
|
|
|
{
|
|
{
|
|
|
- /**
|
|
|
|
|
- * Search constructor.
|
|
|
|
|
- * @param EntityManagerInterface $em
|
|
|
|
|
- */
|
|
|
|
|
public function __construct(
|
|
public function __construct(
|
|
|
- protected EntityManagerInterface $em,
|
|
|
|
|
- protected FilmRepository $repoFilm
|
|
|
|
|
|
|
+ protected readonly EntityManagerInterface $em,
|
|
|
|
|
+ protected readonly FilmRepository $repoFilm
|
|
|
)
|
|
)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @param string $query
|
|
|
|
|
- * @return \App\Entity\Film[]
|
|
|
|
|
|
|
+ * @return Film[]
|
|
|
*/
|
|
*/
|
|
|
public function search(string $query): array
|
|
public function search(string $query): array
|
|
|
{
|
|
{
|
|
@@ -36,8 +32,7 @@ class Search
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @param $query
|
|
|
|
|
- * @return array
|
|
|
|
|
|
|
+ * @return Film[]
|
|
|
*/
|
|
*/
|
|
|
protected function searchByFilm(string $query): array
|
|
protected function searchByFilm(string $query): array
|
|
|
{
|
|
{
|
|
@@ -49,8 +44,7 @@ class Search
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @param $query
|
|
|
|
|
- * @return array
|
|
|
|
|
|
|
+ * @return Film[]
|
|
|
*/
|
|
*/
|
|
|
protected function searchByRealisateur(string $query): array
|
|
protected function searchByRealisateur(string $query): array
|
|
|
{
|
|
{
|
|
@@ -58,11 +52,10 @@ class Search
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @param $query
|
|
|
|
|
- * @return array
|
|
|
|
|
|
|
+ * @return Film[]
|
|
|
*/
|
|
*/
|
|
|
protected function searchByGenre(string $query): array
|
|
protected function searchByGenre(string $query): array
|
|
|
{
|
|
{
|
|
|
return $this->repoFilm->findFilmWithGenreLike($query);
|
|
return $this->repoFilm->findFilmWithGenreLike($query);
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+}
|