Just load the WorkflowPass
compiler pass and the services.yaml
in your project.
After that, when a class supports workflow it'll have two routes (assuming entity dummy
):
api_dummies_state_item PATCH ANY ANY /api/dummies/{id}/state.{_format}
PATCH
with data (must be state
key) {"state": "state_name"}
to change a given resource's state to state_name
.
api_dummies_state_get_item GET ANY ANY /api/dummies/{id}/state.{_format}
GET
receives available states for the given resource.
sure but I'd suggest using a processor instead of the listener from above