With Bruna's inventions, the menu keeps growing… and nobody can find anything anymore: the Captain's Grog sneaks in between two stews. Gorm wants a menu sorted by category: main courses, sides, drinks.
Your mission
- Map the
Categorie(category) entity (categorietable): a generatedid, a uniquenom(name, 50 characters), aposition(the display order on the menu). - Link the two entities:
- every dish belongs to a category, and it's required;
- a category knows its dishes, from cheapest to most expensive.
- Sort the menu: for each category (the controller already passes them in
positionorder), a<section class="categorie">with an<h2>and the<ul class="plats">list of its dishes.
The properties, getters and setters are written: the mapping and the template are up to you. The menu filtered by budget (?budget=) stays a simple list.
The console
The loading command fails as long as Categorie is not an entity: that's expected. Once the mapping is written, run again:
doctrine:schema:update --force app:charger-carte
Reminder
In a relation, the ManyToOne side is the owning side: it holds the foreign key (categorie_id). The OneToMany side is the inverse side: it exists for navigation (categorie.plats) and is declared with mappedBy.