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.
Hi @soyuka !
Thank you for the gist.
I'm currently using this in a SF6.4 + PHP8.3 project.
Can we use this concept to create a POST request?
My requirement is to create a global bulk transition API where we will pass a JSON object in request and then we will iterate over them and change the state of each object.