Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -265,27 +265,19 @@ machine type, use ``camelCased workflow name + StateMachine``::
}
}

Alternatively, use the registry::
.. versionadded:: 6.2

use App\Entity\BlogPost;
use Symfony\Component\Workflow\Registry;

class MyClass
{
private $workflowRegistry;
All workflows and state machines services are tagged since in Symfony 6.2.

public function __construct(Registry $workflowRegistry)
{
$this->workflowRegistry = $workflowRegistry;
}
.. tip::

public function toReview(BlogPost $post)
{
$blogPublishingWorkflow = $this->workflowRegistry->get($post);
If you want to retrieve all workflows, for documentation purposes for example,
you can :doc:`inject all services </service_container/service_subscribers_locators>`
with the following tag:

// ...
}
}
* ``workflow``: all workflows and all state machine;
* ``workflow.workflow``: all workflows;
* ``workflow.state_machine``: all state machines.

.. tip::

Expand Down