The Symfony 6.4 docs state concerning the workflow registry:
Beware that injecting the Registry into your services is not
recommended.
However, I need to get a specific workflow within a service method which decides which workflow to use based on a key. I don’t know in advance which workflow to load, so I can’t inject a specific workflow. How can I do this? For now, I inject the registry. Could I somehow inject the service_container and get it from there later?
2
Answers
Here's my Solution:
You can use service locators to access every workflows.
It’s mentioned in the documentation:
It’s possible to do it easily with Symfony 6/7 using locator attribute: