Skip to content

[Workflow] Remove doc about Registry and tell about tags #17192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 23, 2022
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