Use MicroKernelTrait to bootstrap application. Rewrote routes, controllers and structure of application a bit. Including use of twig.

This commit is contained in:
Krzysztof Płaczek
2024-10-19 16:01:54 +02:00
parent 3d47726a81
commit 5ee1bba812
16 changed files with 1593 additions and 73 deletions

View File

@@ -3,12 +3,15 @@
namespace Krzysiej\RyobiCrawler\Controller;
use Krzysiej\RyobiCrawler\Models\Product;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
final class IndexController extends BaseController
{
public function __invoke(): void
#[Route('/', name: 'app_home')]
public function __invoke(): Response
{
$products = Product::with('price')->orderByDesc('starred')->orderByDesc('created_by')->get();
$this->twig->display('productList.html.twig', ['products' => $products]);
return $this->render('productList.html.twig', ['products' => $products]);
}
}