oroinc / platform

Main OroPlatform package with core functionality.
MIT License
629 stars 351 forks source link

Workflow autostart issues #987

Open vytsci opened 4 years ago

vytsci commented 4 years ago

Summary
We have a workflow with start_step "new" assigned, force_autostart true, we have no transition named start, we have another transition which has is_start true, but when we persist and flush this entity that has this specific workflow, workflow manager throws error "Step "new" of workflow "custom_flow" doesn't have allowed transition "start".

Steps to reproduce
Create any workflow that should autostart automatically and has no start transaction.

Actual Result Fatal error and workflow not started.

Expected Result
Workflow should be started with step "new"

Details about your environment

We tried to configure start transaction, even tried to remove start_step, but then nothing happens. If you leave start_step and have start transaction as is_start true, then same error occurs. I always try make PR, but workflow seems so broken in so many places, for example Listener which registers which workflow to autostart, does not register anything if you have no start_step assigned, but in the docs start_step is mentioned as an optional if you have no start transition assigned. start is used everywhere as start transition even if you have no such transition in your workflow. Ill try to make PR, but i need better understanding of how everything should be. For now adding start to allowed transition for our start step solved an issue, but I think workflow is still broken or documented poorly.

anyt commented 4 years ago

Hi @vytsci, you can configure the basic workflow prototype from UI and dump it to the code with below command:

php bin/console oro:debug:workflow:definitions <workflow-name>

This can help you to find the initial issue in the configuration.

vytsci commented 4 years ago

Ok we solved one issue, as database got somehow corrupted and our new entities dragged old workflow items from the table. But issues still persists where force_autostart does not work if start_step is not present. And start transition should be documented inside docs.

vytsci commented 4 years ago

I dunno this issue is partially true now. Because autostart still not works as expected, but Ive solved fatal errors and it was on our side.