add price feature
This commit is contained in:
parent
15f8db46a0
commit
64f5341371
18 changed files with 484 additions and 157 deletions
|
@ -4,6 +4,7 @@ namespace App\Controller;
|
|||
|
||||
use App\Entity\FoodOrder;
|
||||
use App\Form\FoodOrderType;
|
||||
use App\Form\OrderFinalize;
|
||||
use App\Repository\FoodOrderRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
@ -104,11 +105,21 @@ final class FoodOrderController extends AbstractController
|
|||
], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_food_order_show', methods: ['GET'])]
|
||||
public function show(FoodOrder $foodOrder): Response
|
||||
#[Route('/{id}', name: 'app_food_order_show', methods: ['GET', 'POST'])]
|
||||
public function show(Request $request, FoodOrder $foodOrder, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = null;
|
||||
if ($foodOrder->isClosed()) {
|
||||
$form = $this->createForm(OrderFinalize::class, $foodOrder);
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($foodOrder);
|
||||
$entityManager->flush();
|
||||
}
|
||||
}
|
||||
return $this->render('food_order/show.html.twig', [
|
||||
'food_order' => $foodOrder,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue