Starting actors populate
This commit is contained in:
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Gateway\TMDBGateway;
|
||||
use App\Model\Ltbxd\LtbxdMovie;
|
||||
use App\Repository\MovieRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
@@ -14,23 +14,23 @@ use Symfony\Component\Serializer\SerializerInterface;
|
||||
class HomepageController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly TMDBGateway $TMDBGateway, private readonly SerializerInterface $serializer,
|
||||
private readonly MovieRepository $movieRepository,
|
||||
private readonly TMDBGateway $TMDBGateway,
|
||||
) {}
|
||||
|
||||
#[Route('/')]
|
||||
public function index(SerializerInterface $serializer): Response
|
||||
{
|
||||
// $file = file_get_contents('files/watched.csv');
|
||||
// $ltbxdMovies = $this->serializer->deserialize($file, LtbxdMovie::class.'[]', 'csv');
|
||||
// /** @var LtbxdMovie $ltbxdMovie */
|
||||
// $films = [];
|
||||
// foreach ($ltbxdMovies as $ltbxdMovie) {
|
||||
// // Search movie on TMDB
|
||||
// $film = $this->TMDBGateway->searchMovie($ltbxdMovie->getName());
|
||||
// if ($film) {
|
||||
// $films[] = $film;
|
||||
// }
|
||||
// }
|
||||
$movie = $this->movieRepository->findOneBy([]);
|
||||
$creditsContext = $this->TMDBGateway->getMovieCredits($movie->getTmdbId());
|
||||
$cast = $creditsContext->cast;
|
||||
$actors = [];
|
||||
foreach ($cast as $actor) {
|
||||
if (2 <= $actor->popularity) {
|
||||
$actors[] = $actor;
|
||||
}
|
||||
}
|
||||
dd($actors);
|
||||
|
||||
return $this->render('homepage/index.html.twig');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user