Chapter 10 of the Symfony for PHP developers track
The life of a reservation
6 exercises · 1,730 XP · about 4 h 30 min
MailerMailerInterfaceEmailMAILER_DSNassertEmailCountTemplatedEmailTwig email templateurl() and path()Sending serviceWorkflowState machinePlaces and transitionsmarking_storeinitial_markingTransitions from a controllerGuards#[AsGuardListener]TransitionBlockerworkflow_transitions()Workflow events#[AsEnteredListener]entered and leaveDebugging
The chapter's exercises
-
The first scroll
Exercise 1 · 270 XP · 5 objectives checked by tests
Reservations made on the website are now saved: Pippin added the traveler's email address and the day of the visit to the form. One thing is missing, the house's good manners: a confirmation scroll, sent for every reservation.
MailerMailerInterfaceEmailMAILER_DSNassertEmailCount
-
A scroll with style
Exercise 2 · 270 XP · 5 objectives checked by tests
The confirmation scroll does go out, but Bruna finds it dull: three lines of text, not a single dragon. She wants a real scroll, laid out properly, with a link to discover the menu.
TemplatedEmailTwig email templateurl() and path()Sending service
-
The life of a reservation
Exercise 3 · 280 XP · 5 objectives checked by tests
A reservation has a life: requested by a traveler, confirmed by the tavern, then honored when the evening comes. Unless someone cancels it in the meantime. Today, nothing prevents it from being honored without having been confirmed, or canceled after the meal.
WorkflowState machinePlaces and transitionsmarking_storeinitial_marking
-
Gorm's reservation book
Exercise 4 · 290 XP · 5 objectives checked by tests
Gorm keeps the reservation book in an old notebook full of crossings-out. Pippin has prepared a page for him, /kitchen/reservations, which lists the reservations and offers a button for each possible transition. All that is left is to make these buttons work, and to set two house rules:
Transitions from a controllerGuards#[AsGuardListener]TransitionBlockerworkflow_transitions()
-
Scrolls from the reservation book
Exercise 5 · 280 XP · 5 objectives checked by tests
There is a problem in the tavern: the traveler receives “Your table awaits” as soon as they fill in the form. But nothing is confirmed yet: Gorm can still turn the reservation down, on a fully booked feast night. And when he cancels a reservation, the traveler knows nothing about it.
Workflow events#[AsEnteredListener]entered and leaveMailer
-
🐉 Boss: the misplaced scrolls
Exercise 6 · 340 XP · 5 objectives checked by tests
Pippin “simplified” the reservation book while Gorm was away at the beer fair. Since then: