The Plat entity exists, and so does the table. Bruna even wrote a command to fill her menu: app:charger-carte (load the menu). Every time the preview loads, the console runs for you:
bin/console doctrine:schema:update --force bin/console app:charger-carte
Have a look at the Console tab: the menu is in the database (dbal:run-sql "SELECT nom FROM plat"). Yet the site still displays the old list, hard-coded in the Cuisine service.
Your mission
- Make
Cuisineread the database: inject thePlatRepositoryinto it and rewrite its three methods with it. ThePLATSconstant must disappear. - Update the menu (
menu/index.html.twig):platsis now a list ofPlatobjects, and the slug is read fromplat.slug.
The controllers don't need to change: they already go through Cuisine. That's the whole point of a service.
Going further
Add a dish in SQL from the console, then reload the menu:
dbal:run-sql "INSERT INTO plat (slug, nom, description, prix, specialite) VALUES ('grog', 'Captain''s Grog', 'Hot and treacherous.', 3.2, 0)"
(In SQL, an apostrophe inside a string is written twice: 'Captain''s Grog'.)