Chapter 3 of the Symfony for PHP developers track

The tavern's scrolls

6 exercises · 1,170 XP · about 2 h 45 min

This chapter works on: FormsFormTypeEntityTypeCSRFValidatorConstraintsUniqueEntityEdit formRoute {slug:plat}RelationsPOST-redirect-GETDeletionremoveDebugging

The chapter's exercises

  1. A proper form

    Exercise 1 · 180 XP · 5 objectives checked by tests

    Take another look at Bruna's CuisineController: read each field, convert the price, find the category, redisplay the submitted values… Sixty lines for a single form. And more forms are coming soon (editing a dish, leaving a review).

    FormsFormTypeEntityTypeCSRF

  2. Not just anything on the plate

    Exercise 2 · 180 XP · 5 objectives checked by tests

    The form is gorgeous… and it accepts anything. Pippin has already added a dish with no name, a “Soup” at −3 gold pieces (the tavern was paying him to eat it), and a second “Dwarf Stew”, which crashed the database because of the duplicate slug.

    ValidatorConstraintsUniqueEntity

  3. Bruna fixes her menu

    Exercise 3 · 180 XP · 5 objectives checked by tests

    A typo on the menu: the “Elven Mushroom Pie” has become the “Elven Mushrom Pie”. And the stew's price has to go up (the grumpy dwarf is demanding a raise). Bruna wants to be able to edit a dish without going through the console.

    Edit formRoute {slug:plat}

  4. The guestbook

    Exercise 4 · 200 XP · 5 objectives checked by tests

    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.

    FormsRelationsPOST-redirect-GET

  5. Taking a dish off the menu

    Exercise 5 · 180 XP · 5 objectives checked by tests

    The “Wayfarer Bread” hasn't sold since Legolas told everyone it put him to sleep for three days. Bruna wants to take it off the menu.

    DeletionCSRFremove

  6. 🐉 Boss: the cursed scroll

    Exercise 6 · 250 XP · 5 objectives checked by tests

    Pippin found an old scroll covered in runes in the cellar, and read it out loud in front of the tavern's computer. Since then, the forms have been cursed:

    DebuggingFormsCSRF