add barebones form
This commit is contained in:
parent
138d030b5a
commit
541fd2d40d
24
src/Controller/TicketController.php
Normal file
24
src/Controller/TicketController.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\DataObjects\TicketData;
|
||||
use App\Form\TicketForm;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
final class TicketController extends AbstractController
|
||||
{
|
||||
#[Route('/ticket', name: 'app_ticket')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$data = new TicketData();
|
||||
$form = $this->createForm(TicketForm::class, $data)->handleRequest($request);
|
||||
|
||||
return $this->render('ticket/index.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
}
|
16
src/DataObjects/TicketData.php
Normal file
16
src/DataObjects/TicketData.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataObjects;
|
||||
|
||||
class TicketData
|
||||
{
|
||||
public function __construct(
|
||||
public string $email = '',
|
||||
public string $notes = '',
|
||||
public string $firstname = '',
|
||||
public string $lastname = '',
|
||||
public string $phone = '',
|
||||
)
|
||||
{
|
||||
}
|
||||
}
|
21
src/Form/TicketForm.php
Normal file
21
src/Form/TicketForm.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class TicketForm extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->add('email', EmailType::class)
|
||||
->add('notes', TextareaType::class)
|
||||
->add('firstname', TextType::class)
|
||||
->add('lastname', TextType::class)
|
||||
->add('phone', TextType::class);
|
||||
}
|
||||
}
|
6
templates/ticket/index.html.twig
Normal file
6
templates/ticket/index.html.twig
Normal file
@ -0,0 +1,6 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Bestellen{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user