symfony-docs icon indicating copy to clipboard operation
symfony-docs copied to clipboard

[Workflow] Mark registry as internal and deprecate the service

Open fabpot opened this issue 3 years ago • 2 comments

Q A
Feature PR symfony/symfony#46000
PR author(s) @lyrixx
Merged in 6.2

fabpot avatar Aug 12 '22 12:08 fabpot

TL;DR:

  1. The WorkflowRegistry should never be used (we must not document it)
  2. People have to inject the workflow where they need it. Typing WorkflowInterface works fine if only one workflow exists. Otherwise use named serviced. Example. This exists for ages and works fine. Otherwise, one can still use the raw service id : workflow.[name] or state_machine.[name]
  3. If they need all workflows (docs for examples) they can inject all services tagged with
    • workflow => all workflow + state_machine
    • workflow.workflow => all workflow
    • workflow.state_machine => all state_machine

lyrixx avatar Aug 12 '22 13:08 lyrixx

Hi @lyrixx. Can you make the suggested changes in this section https://symfony.com/doc/current/workflow.html#accessing-the-workflow-in-a-class ? I think what is needed is remove the "Alternatively, ..." part and add a quick note about the services providing all workflows/state machines.

wouterj avatar Aug 12 '22 13:08 wouterj