Resource Lifecycle
Last updated
Was this helpful?
Each operation on a resource follows a well-defined lifecycle. This flow ensures clear separation of concerns between reading data, applying business logic, and producing the final response.
The request is matched to a Resource and an Operation using metadata collected from attributes (eg #[AsResource]).
This step defines which provider, processor, and responder should handle the request.
The provider is responsible for loading or creating the resource object, hydrating it from the request, and validating it before any business logic is applied.
Example: load from Doctrine, create a new instance, populate from request data, validate, or fetch from an external API.
The processor applies the business logic of the operation.
Example: persist the entity, execute domain services, or dispatch events.
You can use the default Doctrine processor, or implement your own for DDD use cases.
The responder produces the final output β it can render a Twig template or redirect to another route.
Last updated
Was this helpful?
Was this helpful?
