Skip to content
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

Provide the State Machine abstraction #15315

Merged
merged 25 commits into from Sep 21, 2023
Merged

Conversation

jakubtobiasz
Copy link
Member

@jakubtobiasz jakubtobiasz commented Sep 16, 2023

Q A
Branch? 1.13
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets continuation of #15253
License MIT

State machine adapters are configurable now!

sylius_core:
    state_machine:
        default_adapter: 'winzou_state_machine' # winzou is the default one, another option is sylius_workflow
        graphs_to_adapters_mapping:
            my_graph_name: 'symfony_workflow' # now every state machine method will be "routed" to the Symfony's Workflow 🎉 

It means we can enable Symfony Workflow one by one for our graphs :).

@jakubtobiasz jakubtobiasz added the DX Issues and PRs aimed at improving Developer eXperience. label Sep 16, 2023
@jakubtobiasz jakubtobiasz requested a review from a team as a code owner September 16, 2023 11:34
@github-actions
Copy link

github-actions bot commented Sep 16, 2023

Bunnyshell Preview Environment deleted

Available commands:

  • /bns:deploy to redeploy the environment

Copy link
Member

@diimpp diimpp left a comment

Choose a reason for hiding this comment

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

What about twig helper functions like sm_can, will they be abstracted as well?

@jakubtobiasz
Copy link
Member Author

Thanks for mentioning about twig functions, I totally forgot about them 😅.

@probot-autolabeler probot-autolabeler bot added the Admin AdminBundle related issues and PRs. label Sep 16, 2023
@probot-autolabeler probot-autolabeler bot added the API APIs related issues and PRs. label Sep 16, 2023
@jakubtobiasz jakubtobiasz changed the title Provide the State Machine abstraction 🚧 Provide the State Machine abstraction Sep 16, 2023
@jakubtobiasz jakubtobiasz changed the title 🚧 Provide the State Machine abstraction Provide the State Machine abstraction Sep 17, 2023
Comment on lines +25 to +28
/**
* @return array<string>|null
*/
public function getTos(): ?array;
Copy link
Member Author

Choose a reason for hiding this comment

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

We want to be compatible with Workflow, so despite Winzou allows to return only 1 "to", we return an array to tos.

Comment on lines +101 to +110
->arrayNode('state_machine')
->addDefaultsIfNotSet()
->children()
->scalarNode('default_adapter')->defaultValue('winzou_state_machine')->end()
->arrayNode('graphs_to_adapters_mapping')
->useAttributeAsKey('graph_name')
->scalarPrototype()->end()
->end()
->end()
->end()
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we shouldn't deprecate this config immediately after adding it

@GSadee GSadee merged commit 06a325e into Sylius:1.13 Sep 21, 2023
25 checks passed
@GSadee
Copy link
Member

GSadee commented Sep 21, 2023

Thank you, Jacob! 🎉

@jakubtobiasz jakubtobiasz deleted the SYL-2988 branch September 21, 2023 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin AdminBundle related issues and PRs. API APIs related issues and PRs. DX Issues and PRs aimed at improving Developer eXperience.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants