Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lyrixx
Copy link
Member

@lyrixx lyrixx commented Apr 11, 2025

Q A
Branch? 7.4
Bug fix? no
New feature? yes
Deprecations? yes
Issues Fix #60107
License MIT

Allow to handle complex workflow like:

make_table:
    transitions:
        start:
            from: init
            to:
                -   place: prepare_leg
                    weight: 4
                -   place: prepare_top
                    weight: 1
                -   place: stopwatch_running
                    weight: 1
        build_leg:
            from: prepare_leg
            to: leg_created
        build_top:
            from: prepare_top
            to: top_created
        join:
            from:
                - place: leg_created
                  weight: 4
                - top_created
                - stopwatch_running
            to: finished
$definition = new Definition(
    [],
    [
        new Transition('start', 'init', [new Arc('prepare_leg', 4), 'prepare_top', 'stopwatch_running']),
        new Transition('build_leg', 'prepare_leg', 'leg_created'),
        new Transition('build_top', 'prepare_top', 'top_created'),
        new Transition('join', [new Arc('leg_created', 4), 'top_created', 'stopwatch_running'], 'finished'),
    ]
);

$subject = new Subject();
$workflow = new Workflow($definition);

$workflow->apply($subject, 'start');

$workflow->apply($subject, 'build_leg');
$workflow->apply($subject, 'build_top');
$workflow->apply($subject, 'build_leg');
$workflow->apply($subject, 'build_leg');
$workflow->apply($subject, 'build_leg');
$workflow->apply($subject, 'join');

Another example, based on https://demo-symfony-workflow.cleverapps.io/articles/show/1
workflow.webm

@lyrixx
Copy link
Member Author

lyrixx commented Apr 12, 2025

@bkosun Thanks for the review. I addressed your comments

@fabpot fabpot modified the milestones: 7.3, 7.4 May 26, 2025
@lyrixx lyrixx force-pushed the workflow-transition-weight branch from 9a13aba to 7758d3d Compare June 4, 2025 10:00
@lyrixx
Copy link
Member Author

lyrixx commented Jun 4, 2025

Thanks for the review, I addressed your comments, and also rebased.

@lyrixx
Copy link
Member Author

lyrixx commented Jun 4, 2025

I don't get why the tests are broken:

4) Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\YamlFrameworkExtensionTest::testWorkflowAreValidated
Failed asserting that exception of type "ReflectionException" matches expected exception "Symfony\Component\Workflow\Exception\InvalidDefinitionException". Message was: "Class "Symfony\Component\Workflow\Arc" does not exist" at

since I put

  "require-dev": {
      "symfony/workflow": "^7.4|^8.0",

in src/Symfony/Bundle/FrameworkBundle/composer.json

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase needed + some thoughts.

@lyrixx lyrixx force-pushed the workflow-transition-weight branch from 7758d3d to 15848ab Compare October 1, 2025 10:22
@lyrixx
Copy link
Member Author

lyrixx commented Oct 1, 2025

Comment addressed, an PR rebased

@lyrixx lyrixx force-pushed the workflow-transition-weight branch from 15848ab to a52f9a3 Compare October 1, 2025 12:33
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after some CS fixes

@lyrixx lyrixx force-pushed the workflow-transition-weight branch from a52f9a3 to c936834 Compare October 1, 2025 14:41
@nicolas-grekas nicolas-grekas force-pushed the workflow-transition-weight branch from c936834 to 207fc49 Compare October 1, 2025 15:10
@nicolas-grekas
Copy link
Member

Thank you @lyrixx.

@xabbuh
Copy link
Member

xabbuh commented Nov 29, 2025

@lyrixx Looking at how we use getFroms()/getTos() I wonder if the idea was to deprecate the argument in 8.1+ and let both methods only return list of Arc instances in 9.0?

@lyrixx
Copy link
Member Author

lyrixx commented Dec 1, 2025

🤔 I don't remember why I did that! I guess I wanted to deprecate things at some point.

Now, I don't think it worth a deprecated. I would open a PR to add real args. What do you think ?

@xabbuh
Copy link
Member

xabbuh commented Dec 1, 2025

I was basically wondering because there are now different places where call these methods with true and afterwards only extract the place so we could as well have left those places untouched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Workflow] Unexpected marking with a complex workflow after transition

8 participants