Skip to content

[Workflow] Document the fact workflows are tagged #20876

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

Open
lyrixx opened this issue Apr 10, 2025 · 0 comments
Open

[Workflow] Document the fact workflows are tagged #20876

lyrixx opened this issue Apr 10, 2025 · 0 comments
Labels

Comments

@lyrixx
Copy link
Member

lyrixx commented Apr 10, 2025

Example usage:

use Symfony\Component\DependencyInjection\ServiceLocator;
use Symfony\Component\DependencyInjection\Attribute\AutowireLocator;
use Symfony\Component\Workflow\Attribute\AsTransitionListener;
use Symfony\Component\Workflow\Event\TransitionEvent;

class GenericListener
{
   public function __construct(
       #[AutowireLocator('workflow', 'name')]
       private ServiceLocator $workflows
   ) {
   }

   #[AsTransitionListener()]
   public function doSomething(TransitionEvent $event): void
   {
       $workflow = $this->workflows->get($event->getWorkflowName());
   }
}

iterator works as well

@OskarStark OskarStark changed the title [Workflow] Document the fact workflows are tagget [Workflow] Document the fact workflows are tagged Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants