-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[WIP][Workflow] Changed initial_places to initial_marking, added property instead of type #30662
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -621,14 +621,14 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $ | |
|
||
// Create places | ||
$places = array_column($workflow['places'], 'name'); | ||
$initialPlaces = $workflow['initial_places'] ?? $workflow['initial_place'] ?? []; | ||
$initialMarking = $workflow['initial_marking'] ?? $workflow['initial_place'] ?? []; | ||
|
||
// Create a Definition | ||
$definitionDefinition = new Definition(Workflow\Definition::class); | ||
$definitionDefinition->setPublic(false); | ||
$definitionDefinition->addArgument($places); | ||
$definitionDefinition->addArgument($transitions); | ||
$definitionDefinition->addArgument($initialPlaces); | ||
$definitionDefinition->addArgument($initialMarking); | ||
$definitionDefinition->addArgument($metadataStoreDefinition); | ||
|
||
// Create MarkingStore | ||
|
@@ -637,6 +637,12 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $ | |
foreach ($workflow['marking_store']['arguments'] as $argument) { | ||
$markingStoreDefinition->addArgument($argument); | ||
} | ||
if ('method' === $workflow['marking_store']['type']) { | ||
$markingStoreDefinition->setArguments([ | ||
'state_machine' === $type, //single state | ||
lyrixx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
$workflow['marking_store']['property'] ?? 'marking', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be the default value in the Configuration (not the extension) |
||
]); | ||
} | ||
} elseif (isset($workflow['marking_store']['service'])) { | ||
$markingStoreDefinition = new Reference($workflow['marking_store']['service']); | ||
} | ||
|
@@ -676,7 +682,7 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $ | |
->addTransitions(array_map(function (Reference $ref) use ($container): Workflow\Transition { | ||
return $container->get((string) $ref); | ||
}, $transitions)) | ||
->setInitialPlace($initialPlaces) | ||
->setInitialPlace($initialMarking) | ||
->build() | ||
; | ||
$validator->validate($realDefinition, $name); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -270,7 +270,7 @@ | |
|
||
<xsd:complexType name="workflow"> | ||
<xsd:sequence> | ||
<xsd:element name="initial-place" type="xsd:string" minOccurs="0" maxOccurs="unbounded" /> | ||
<xsd:element name="initial-marking" type="xsd:string" minOccurs="0" maxOccurs="unbounded" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. both element should be here to support the BC, no ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes |
||
<xsd:element name="marking-store" type="marking_store" minOccurs="0" maxOccurs="1" /> | ||
<xsd:element name="support" type="xsd:string" minOccurs="0" maxOccurs="unbounded" /> | ||
<xsd:element name="place" type="place" minOccurs="0" maxOccurs="unbounded" /> | ||
|
@@ -280,6 +280,7 @@ | |
<xsd:attribute name="name" type="xsd:string" /> | ||
<xsd:attribute name="type" type="workflow_type" /> | ||
<xsd:attribute name="initial-place" type="xsd:string" /> | ||
<xsd:attribute name="initial-marking" type="xsd:string" /> | ||
<xsd:attribute name="support-strategy" type="xsd:string" /> | ||
<xsd:attribute name="enabled" type="xsd:boolean" /> | ||
</xsd:complexType> | ||
|
@@ -295,12 +296,14 @@ | |
</xsd:sequence> | ||
<xsd:attribute name="type" type="marking_store_type" /> | ||
<xsd:attribute name="service" type="xsd:string" /> | ||
<xsd:attribute name="property" type="xsd:string" /> | ||
</xsd:complexType> | ||
|
||
<xsd:simpleType name="marking_store_type"> | ||
<xsd:restriction base="xsd:string"> | ||
<xsd:enumeration value="multiple_state" /> | ||
<xsd:enumeration value="single_state" /> | ||
<xsd:enumeration value="method" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a kind of bug fix |
||
</xsd:restriction> | ||
</xsd:simpleType> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest; | ||
|
||
$container->loadFromExtension('framework', [ | ||
'workflows' => [ | ||
'my_workflow' => [ | ||
'type' => 'workflow', | ||
'marking_store' => [ | ||
'property' => 'states', | ||
'service' => 'workflow_service', | ||
], | ||
'supports' => [ | ||
FrameworkExtensionTest::class, | ||
], | ||
'places' => [ | ||
'first', | ||
'last', | ||
], | ||
'transitions' => [ | ||
'go' => [ | ||
'from' => [ | ||
'first', | ||
], | ||
'to' => [ | ||
'last', | ||
], | ||
], | ||
], | ||
], | ||
], | ||
]); |
Uh oh!
There was an error while loading. Please reload this page.