Start on the fridge frontend
Create list overview without styling Start on editer of fridge
This commit is contained in:
34
src/Controller/FridgeController.php
Normal file
34
src/Controller/FridgeController.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Fridge;
|
||||
use App\Form\FridgeType;
|
||||
use App\Repository\FridgeRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/fridge', name: 'fridge')]
|
||||
class FridgeController extends AbstractController
|
||||
{
|
||||
#[Route('/list', name: '_list')]
|
||||
public function list(FridgeRepository $repo)
|
||||
{
|
||||
$fridges = $repo->findAll();
|
||||
|
||||
return $this->render('fridge/list.html.twig', [
|
||||
'fridges' => $fridges,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/single/{fridge}', name: '_single')]
|
||||
public function single(Fridge $fridge, Request $request)
|
||||
{
|
||||
$form = $this->createForm(FridgeType::class, $fridge);
|
||||
|
||||
return $this->render('fridge/single.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user