-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Added XML support for Workflow configuration #20458
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow.php
This file was deleted.
Oops, something went wrong.
92 changes: 92 additions & 0 deletions
92
src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflows.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?php | ||
|
||
use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest; | ||
|
||
$container->loadFromExtension('framework', array( | ||
'workflows' => array( | ||
'article' => array( | ||
'type' => 'workflow', | ||
'marking_store' => array( | ||
'type' => 'multiple_state', | ||
), | ||
'supports' => array( | ||
FrameworkExtensionTest::class, | ||
), | ||
'initial_place' => 'draft', | ||
'places' => array( | ||
'draft', | ||
'wait_for_journalist', | ||
'approved_by_journalist', | ||
'wait_for_spellchecker', | ||
'approved_by_spellchecker', | ||
'published', | ||
), | ||
'transitions' => array( | ||
'request_review' => array( | ||
'from' => 'draft', | ||
'to' => array('wait_for_journalist', 'wait_for_spellchecker'), | ||
), | ||
'journalist_approval' => array( | ||
'from' => 'wait_for_journalist', | ||
'to' => 'approved_by_journalist', | ||
), | ||
'spellchecker_approval' => array( | ||
'from' => 'wait_for_spellchecker', | ||
'to' => 'approved_by_spellchecker', | ||
), | ||
'publish' => array( | ||
'from' => array('approved_by_journalist', 'approved_by_spellchecker'), | ||
'to' => 'published', | ||
), | ||
), | ||
), | ||
'pull_request' => array( | ||
'type' => 'state_machine', | ||
'marking_store' => array( | ||
'type' => 'single_state', | ||
), | ||
'supports' => array( | ||
FrameworkExtensionTest::class, | ||
), | ||
'initial_place' => 'start', | ||
'places' => array( | ||
'start', | ||
'coding', | ||
'travis', | ||
'review', | ||
'merged', | ||
'closed', | ||
), | ||
'transitions' => array( | ||
'submit' => array( | ||
'from' => 'start', | ||
'to' => 'travis', | ||
), | ||
'update' => array( | ||
'from' => array('coding', 'travis', 'review'), | ||
'to' => 'travis', | ||
), | ||
'wait_for_review' => array( | ||
'from' => 'travis', | ||
'to' => 'review', | ||
), | ||
'request_change' => array( | ||
'from' => 'review', | ||
'to' => 'coding', | ||
), | ||
'accept' => array( | ||
'from' => 'review', | ||
'to' => 'merged', | ||
), | ||
'reject' => array( | ||
'from' => 'review', | ||
'to' => 'closed', | ||
), | ||
'reopen' => array( | ||
'from' => 'closed', | ||
'to' => 'review', | ||
), | ||
), | ||
), | ||
), | ||
)); |
29 changes: 0 additions & 29 deletions
29
src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflow.xml
This file was deleted.
Oops, something went wrong.
83 changes: 83 additions & 0 deletions
83
src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflows.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?xml version="1.0" ?> | ||
|
||
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:framework="http://symfony.com/schema/dic/symfony" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd | ||
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> | ||
|
||
<framework:config> | ||
<framework:workflow name="article" type="workflow" initial-place="draft"> | ||
<framework:marking-store type="multiple_state"> | ||
<framework:argument>a</framework:argument> | ||
<framework:argument>a</framework:argument> | ||
</framework:marking-store> | ||
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support> | ||
<framework:place>draft</framework:place> | ||
<framework:place>wait_for_journalist</framework:place> | ||
<framework:place>approved_by_journalist</framework:place> | ||
<framework:place>wait_for_spellchecker</framework:place> | ||
<framework:place>approved_by_spellchecker</framework:place> | ||
<framework:place>published</framework:place> | ||
<framework:transition name="request_review"> | ||
<framework:from>draft</framework:from> | ||
<framework:to>wait_for_journalist</framework:to> | ||
<framework:to>wait_for_spellchecker</framework:to> | ||
</framework:transition> | ||
<framework:transition name="journalist_approval"> | ||
<framework:from>wait_for_journalist</framework:from> | ||
<framework:to>approved_by_journalist</framework:to> | ||
</framework:transition> | ||
<framework:transition name="spellchecker_approval"> | ||
<framework:from>wait_for_spellcheker</framework:from> | ||
<framework:to>approved_by_spellchker</framework:to> | ||
</framework:transition> | ||
<framework:transition name="publish"> | ||
<framework:from>approved_by_journalist</framework:from> | ||
<framework:from>approved_by_spellchker</framework:from> | ||
<framework:to>published</framework:to> | ||
</framework:transition> | ||
</framework:workflow> | ||
|
||
<framework:workflow name="pull_request" type="state_machine" initial-place="start"> | ||
<framework:marking-store type="single_state"/> | ||
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support> | ||
<framework:place>start</framework:place> | ||
<framework:place>coding</framework:place> | ||
<framework:place>travis</framework:place> | ||
<framework:place>review</framework:place> | ||
<framework:place>merged</framework:place> | ||
<framework:place>closed</framework:place> | ||
<framework:transition name="submit"> | ||
<framework:from>start</framework:from> | ||
<framework:to>travis</framework:to> | ||
</framework:transition> | ||
<framework:transition name="update"> | ||
<framework:from>coding</framework:from> | ||
<framework:from>travis</framework:from> | ||
<framework:from>review</framework:from> | ||
<framework:to>travis</framework:to> | ||
</framework:transition> | ||
<framework:transition name="wait_for_review"> | ||
<framework:from>travis</framework:from> | ||
<framework:to>review</framework:to> | ||
</framework:transition> | ||
<framework:transition name="request_change"> | ||
<framework:from>review</framework:from> | ||
<framework:to>coding</framework:to> | ||
</framework:transition> | ||
<framework:transition name="accept"> | ||
<framework:from>review</framework:from> | ||
<framework:to>merged</framework:to> | ||
</framework:transition> | ||
<framework:transition name="reject"> | ||
<framework:from>review</framework:from> | ||
<framework:to>closed</framework:to> | ||
</framework:transition> | ||
<framework:transition name="reopen"> | ||
<framework:from>closed</framework:from> | ||
<framework:to>review</framework:to> | ||
</framework:transition> | ||
</framework:workflow> | ||
</framework:config> | ||
</container> |
16 changes: 0 additions & 16 deletions
16
src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/workflow.yml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing
->fixXmlConfig('workflow')
on the root node IMO, as having aworkflows
node for the list of workflows does not match the way things are done (and btw, it will cause issues when you define 1 vs several workflows in XML currently AFAIK. Please test this case)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is the
xsd:all
node which we use as the top-level node of theconfig
node. Afaik this doesn't allow us to specifiy severalworkflow
nodes. That's why theworkflow
nodes are wrapped inside theworkflows
node and callingfixXmlConfig()
isn't necessary for theworkflow
config node.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then please write a test which defined multiple workflows in the same file too. I'm quite sure that the current setup is broken (it works by chance here when there is a single workflow, due to the way XML gets parsed, which is different when there is a single child with a given tag vs multiple childs, which is precisely why we fix the XML config for prototyped nodes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. Tests added and XSD updated accordingly.