Skip to content

Issue with workflow calling every transitions #38960

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

Closed
nathan-de-pachtere opened this issue Nov 2, 2020 · 1 comment
Closed

Issue with workflow calling every transitions #38960

nathan-de-pachtere opened this issue Nov 2, 2020 · 1 comment
Labels

Comments

@nathan-de-pachtere
Copy link

Hey guys !

I'm working with Workflow 4.4.16 (SF 4.4), here is the workflow declared in the workflow.yaml file.

signature:
  type: 'state_machine'
  audit_trail:
     enabled: true
  marking_store:
     type: 'method'
     property: 'state'
  initial_marking: created
  supports:
    - App\Entity\Signature
  places:
    - created
    - code_sent
    - signed
  transitions:
     send_code:
       from: created
       to: code_sent
     sign:
       from: code_sent
       to: signed

Issue

When I use $workflow->apply($signature, 'send_code') the SendCode transition is called but after that it automatically call the next onGuard event on Sign (the next transition). And it throw an error because of the code inside the Guard ... That's create beacause my logic is working but I don't want the sign transition trigerred just after the code_send

It seems to be the apply() function which test each transition guard and dispatch them.

Do you have any idea what is happening ?

@lyrixx
Copy link
Member

lyrixx commented Nov 2, 2020

Yes this is a feature: the workflow tries to dispatch 'announce' event when a transition is available.

You can disable this feature thanks to the context or globally with the configuration (sf 5.1 and 5.2)

https://symfony.com/doc/current/workflow.html#using-events

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

3 participants