diff --git a/src/Controller/FridgeController.php b/src/Controller/FridgeController.php new file mode 100644 index 0000000..cc00a7f --- /dev/null +++ b/src/Controller/FridgeController.php @@ -0,0 +1,34 @@ +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(), + ]); + } +} \ No newline at end of file diff --git a/src/Form/FridgeType.php b/src/Form/FridgeType.php new file mode 100644 index 0000000..c3fee99 --- /dev/null +++ b/src/Form/FridgeType.php @@ -0,0 +1,29 @@ +add('name') + ->add('description') + ->add('productLines') + ->add('save', SubmitType::class) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Fridge::class, + ]); + } +} diff --git a/templates/base/navbar.html.twig b/templates/base/navbar.html.twig index fbf3dc1..f4f9662 100644 --- a/templates/base/navbar.html.twig +++ b/templates/base/navbar.html.twig @@ -2,7 +2,8 @@