fix: moves SearchController to src/Controller
This commit is contained in:
28
src/Controller/SearchController.php
Normal file
28
src/Controller/SearchController.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Search\Action\Handler\SearchHandler;
|
||||
use App\Search\Action\Input\SearchInput;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
final class SearchController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private SearchHandler $searchHandler,
|
||||
) {}
|
||||
|
||||
#[Route('/search', name: 'app_search', methods: ['GET'])]
|
||||
public function index(
|
||||
SearchInput $searchInput,
|
||||
): Response
|
||||
{
|
||||
$results = $this->searchHandler->handle($searchInput->toCommand());
|
||||
|
||||
return $this->render('search/results.html.twig', [
|
||||
'results' => $results,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user