32 lines
764 B
PHP
32 lines
764 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace App\Controller;
|
||
|
|
|
||
|
|
use App\Gateway\TMDBGateway;
|
||
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||
|
|
use Symfony\Component\HttpClient\Exception\ClientException;
|
||
|
|
use Symfony\Component\HttpFoundation\Response;
|
||
|
|
use Symfony\Component\Routing\Attribute\Route;
|
||
|
|
|
||
|
|
class HomepageController extends AbstractController
|
||
|
|
{
|
||
|
|
public function __construct(
|
||
|
|
private readonly TMDBGateway $TMDBGateway,
|
||
|
|
) {
|
||
|
|
}
|
||
|
|
|
||
|
|
#[Route('/')]
|
||
|
|
public function index(): Response
|
||
|
|
{
|
||
|
|
try {
|
||
|
|
dd($this->TMDBGateway->searchMovie('The Batman'));
|
||
|
|
} catch (ClientException $e) {
|
||
|
|
dd($e->getResponse()->getInfo());
|
||
|
|
}
|
||
|
|
|
||
|
|
return $this->render('homepage/index.html.twig');
|
||
|
|
}
|
||
|
|
}
|