Controller snelli, servizi autowired, migrazioni Doctrine revisionate.
Constitution — Symfony app
Version 1.0.0 · Ratified 2026-11-10
These principles hold for every spec, plan and task of the project. A spec may add rules; it never weakens these.
-
Thin controllers. Controllers map the request to a DTO (
#[MapRequestPayload]or a form), call one service and return a response. Business rules and Doctrine queries inside a controller fail the review. -
Autowired services. Services are autowired and autoconfigured from
services.yamland receive dependencies through the constructor. Fetching services from the container ($container->get) in application code is not allowed. -
Doctrine migrations reviewed. Every mapping change ships a Doctrine migration in the same pull request, and
doctrine:schema:validateruns in CI. Migrations that rewrite large tables are planned to keep the previous release working. -
Validation and voters. Input DTOs carry Validator constraints and are validated before use. Access to a resource is decided by voters through
#[IsGranted]ordenyAccessUnlessGranted, not by role checks in services. -
Messenger for slow work. Email, exports and third-party calls are messages handled asynchronously by Symfony Messenger with a retry strategy and a failure transport. Handlers are idempotent.
-
Static analysis and tests. PHPStan runs at level 8 or above in CI. Each route has a functional test with
WebTestCasecovering success, invalid input and denied access.