!20 add createdby field to order form
All checks were successful
/ ls (pull_request) Successful in 32s
/ ls (push) Successful in 30s

This commit is contained in:
Jonas 2024-06-30 09:56:35 +02:00
parent 511f12f10f
commit 70041d7357
Signed by: lubiana
SSH key fingerprint: SHA256:gkqM8DUX4Blf6P52fycW8ISTd+4eAHH+Uzu9iyc8hAM
4 changed files with 7 additions and 0 deletions

View file

@ -26,6 +26,8 @@ final class FoodOrderController extends AbstractController
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$foodOrder = new FoodOrder;
$username = $request->cookies->get('username', 'nobody');
$foodOrder->setCreatedBy($username);
$form = $this->createForm(FoodOrderType::class, $foodOrder, [
'action' => $this->generateUrl('app_food_order_new'),
]);

View file

@ -26,6 +26,9 @@ final class OrderItemController extends AbstractController
}
$orderItem = new OrderItem;
$username = $request->cookies->get('username', 'nobody');
$orderItem->setCreatedBy($username);
$form = $this->createForm(OrderItemType::class, $orderItem);
$form->handleRequest($request);

View file

@ -24,6 +24,7 @@ final class FoodOrderType extends AbstractType
->add(child: 'closedAt', options: [
'label' => 'closes at',
])
->add(child: 'createdBy')
;
if ($action !== null) {
$builder->setAction($action);

View file

@ -18,6 +18,7 @@ final class OrderItemType extends AbstractType
'data' => $options['name'] ?? '',
])
->add('extras')
->add('createdBy')
;
}