symfony-yoandev-architecture
Installation
SKILL.md
Architecture
Tier: core — the layer contract and the five rules live here, and none of them is optional. The one on-demand item is the deptrac configuration that enforces it mechanically (
symfony-yoandev-quality).
Where code goes, and why the boundary is where it is.
One rule generates most of the others: the entity holds no rule, so the service holds every rule. Everything below follows from that.
The layer contract
| Layer | May do | May not do |
|---|---|---|
| Controller | Read the request, call one service, choose a representation | Business rules, EntityManager, DQL, flush() |
| Service | Every business rule, orchestration, flush() |
Build queries, know that HTTP exists, return entities to the outside |
| Repository | DQL, QueryBuilder, SQL, persist(), remove() |
Business rules, flush() |
| DTO | Carry data across a boundary, hold validation constraints | Depend on Doctrine, contain logic beyond normalisation |
| Entity | Mapped state, getters, setters, value constants | Invariants, publish()-style domain methods |