Forms, services and JSON
Part 3 of the Symfony course. Form types and Assert validation, services with autowiring, controllers that return JSON, and the Serializer.
The cards below open the lessons of the part, and the tree lists them in the reading order of the whole
course. The previous and the next page at the bottom move through that order.
3.1
Forms
How a FormType class defines fields, renders in Twig, and handles the request with an isValid check.
Open
3.2
Validation
How Assert constraints guard entities, run inside forms, run manually, and carry custom messages.
Open
3.3
Services and DI
How plain PHP classes become shared services, autowire through constructors, bind in services.yaml, and stay lazy.
Open
3.4
JSON controllers
How controller actions return JSON with the json helper, status codes, groups preview, and error shapes.
Open
3.5
Serializer
How the Serializer turns objects into arrays with normalize, groups, circular guards, and date formats.
Open