Starting actors populate

This commit is contained in:
thibaud-leclere
2026-01-15 14:01:45 +01:00
parent be171b45b4
commit dcc47fcb65
5 changed files with 95 additions and 24 deletions

View File

@@ -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');
}