8000 [Workflow] Remove registry workflow retrieval occurrences by alexandre-daubois · Pull Request #18691 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[Workflow] Remove registry workflow retrieval occurrences #18691

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 3, 2023
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
24 changes: 1 addition & 23 deletions workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -275,28 +275,6 @@ machine type, use ``camelCased workflow name + StateMachine``::
}
}

Alternatively, use the registry::

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

class MyClass
{
private $workflowRegistry;

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

public function toReview(BlogPost $post)
{
$blogPublishingWorkflow = $this->workflowRegistry->get($post);

// ...
}
}

.. tip::

You can find the list of available workflow services with the
Expand Down Expand Up @@ -1051,7 +1029,7 @@ In a :ref:`flash message <flash-messages>` in your controller::

// $transition = ...; (an instance of Transition)

// $workflow is a Workflow instance retrieved from the Registry or injected directly (see above)
// $workflow is an injected Workflow instance
$title = $workflow->getMetadataStore()->getMetadata('title', $transition);
$this->addFlash('info', "You have successfully applied the transition with title: '$title'");

Expand Down
0