Saturday night, the Fellowship of the Ring showed up unannounced: nine adventurers, three tables, zero seats. Gorm wants people to be able to book. First step: a page that announces the table for the number of guests given in the address, for example /reservation?personnes=4 (personnes = people).
The reservation/index.html.twig template is ready: it expects a personnes variable.
Your mission
- Declare the
/reservationroute, namedapp_reservation, onReservationController::index(). - Read the number of people from the query string (
?personnes=…). Without the parameter, the table is for 2. - Reject absurd values: only a number between 1 and 12, otherwise a 400 error (bad request).
- Add a link to the reservation page in the navigation.
Try it in the preview: ?personnes=5, ?personnes=0, ?personnes=dragon.
Reminder
Rather than reading $request->query and validating everything by hand, Symfony's attributes describe what the action expects: the framework takes care of converting and rejecting.