← Todas las plantillas

Controladores delgados, servicios autowired, migraciones de Doctrine revisadas.

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.

  1. 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.

  2. Autowired services. Services are autowired and autoconfigured from services.yaml and receive dependencies through the constructor. Fetching services from the container ($container->get) in application code is not allowed.

  3. Doctrine migrations reviewed. Every mapping change ships a Doctrine migration in the same pull request, and doctrine:schema:validate runs in CI. Migrations that rewrite large tables are planned to keep the previous release working.

  4. Validation and voters. Input DTOs carry Validator constraints and are validated before use. Access to a resource is decided by voters through #[IsGranted] or denyAccessUnlessGranted, not by role checks in services.

  5. 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.

  6. Static analysis and tests. PHPStan runs at level 8 or above in CI. Each route has a functional test with WebTestCase covering success, invalid input and denied access.