Gorm has put an old grimoire on the counter: the guestbook. Customers scribble their reviews of the dishes in it… and nobody can decipher them. He wants it online, under each dish page.
The Avis (review) entity already exists (auteur = author, note = a rating from 1 to 5 tankards, message, date), with its constraints, and each dish knows its reviews (plat.avis).
Your mission
- Complete
AvisType: the author, the rating (a whole number) and the message (a text area). - On a dish page (
MenuController::plat()), offer this form for a new review of this dish. If it is valid: save it, add the flash message “Thank you for your review!”, then redirect to the dish page. - In
menu/plat.html.twig, display the reviews (one<article class="avis">per review, the rating in tankards 🍺, the message, the author, the date), then the form with a “Post my review” button.
Reminder
The form fills the object you hand it: create the Avis already attached to the dish, before createForm(). The user doesn't have to choose the dish: the page already knows which one.