[Workflow] Changed initial_places to initial_marking, added property instead of type
This commit is contained in:
parent
5fe3701f05
commit
73708a61b6
@ -166,11 +166,6 @@ Workflow
|
|||||||
initial_places: [draft]
|
initial_places: [draft]
|
||||||
```
|
```
|
||||||
|
|
||||||
Yaml
|
|
||||||
----
|
|
||||||
|
|
||||||
* Using a mapping inside a multi-line string is deprecated and will throw a `ParseException` in 5.0.
|
|
||||||
|
|
||||||
Workflow
|
Workflow
|
||||||
--------
|
--------
|
||||||
|
|
||||||
@ -202,19 +197,22 @@ Workflow
|
|||||||
```yaml
|
```yaml
|
||||||
framework:
|
framework:
|
||||||
workflows:
|
workflows:
|
||||||
|
type: workflow
|
||||||
article:
|
article:
|
||||||
marking_store:
|
marking_store:
|
||||||
type: multiple
|
type: multiple
|
||||||
|
arguments: states
|
||||||
```
|
```
|
||||||
|
|
||||||
After:
|
After:
|
||||||
```yaml
|
```yaml
|
||||||
framework:
|
framework:
|
||||||
workflows:
|
workflows:
|
||||||
|
type: workflow
|
||||||
article:
|
article:
|
||||||
marking_store:
|
marking_store:
|
||||||
type: method
|
type: method
|
||||||
|
property: states
|
||||||
```
|
```
|
||||||
|
|
||||||
* `SingleStateMarkingStore` is deprecated. Use `MethodMarkingStore` instead.
|
* `SingleStateMarkingStore` is deprecated. Use `MethodMarkingStore` instead.
|
||||||
@ -225,16 +223,21 @@ Workflow
|
|||||||
workflows:
|
workflows:
|
||||||
article:
|
article:
|
||||||
marking_store:
|
marking_store:
|
||||||
type: single
|
arguments: state
|
||||||
```
|
```
|
||||||
|
|
||||||
After:
|
After:
|
||||||
```yaml
|
```yaml
|
||||||
framework:
|
framework:
|
||||||
workflows:
|
workflows:
|
||||||
|
type: state_machine
|
||||||
article:
|
article:
|
||||||
marking_store:
|
marking_store:
|
||||||
type: method
|
type: method
|
||||||
arguments:
|
property: state
|
||||||
- true
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Yaml
|
||||||
|
----
|
||||||
|
|
||||||
|
* Using a mapping inside a multi-line string is deprecated and will throw a `ParseException` in 5.0.
|
||||||
|
@ -388,8 +388,47 @@ Workflow
|
|||||||
* `ClassInstanceSupportStrategy` has been removed, use `InstanceOfSupportStrategy` instead.
|
* `ClassInstanceSupportStrategy` has been removed, use `InstanceOfSupportStrategy` instead.
|
||||||
* `MarkingStoreInterface::setMarking()` has a third argument: `array $context = []`.
|
* `MarkingStoreInterface::setMarking()` has a third argument: `array $context = []`.
|
||||||
* Removed support of `initial_place`. Use `initial_places` instead.
|
* Removed support of `initial_place`. Use `initial_places` instead.
|
||||||
* `MultipleStateMarkingStore` has been removed.
|
* `MultipleStateMarkingStore` has been removed. Use `MethodMarkingStore` instead.
|
||||||
* `SingleStateMarkingStore` has been removed.
|
|
||||||
|
Before:
|
||||||
|
```yaml
|
||||||
|
framework:
|
||||||
|
workflows:
|
||||||
|
type: workflow
|
||||||
|
article:
|
||||||
|
marking_store:
|
||||||
|
type: multiple
|
||||||
|
arguments: states
|
||||||
|
```
|
||||||
|
|
||||||
|
After:
|
||||||
|
```yaml
|
||||||
|
framework:
|
||||||
|
workflows:
|
||||||
|
type: workflow
|
||||||
|
article:
|
||||||
|
marking_store:
|
||||||
|
property: states
|
||||||
|
```
|
||||||
|
* `SingleStateMarkingStore` has been removed. Use `MethodMarkingStore` instead.
|
||||||
|
|
||||||
|
Before:
|
||||||
|
```yaml
|
||||||
|
framework:
|
||||||
|
workflows:
|
||||||
|
article:
|
||||||
|
marking_store:
|
||||||
|
arguments: state
|
||||||
|
```
|
||||||
|
|
||||||
|
After:
|
||||||
|
```yaml
|
||||||
|
framework:
|
||||||
|
workflows:
|
||||||
|
article:
|
||||||
|
marking_store:
|
||||||
|
property: state
|
||||||
|
```
|
||||||
|
|
||||||
Yaml
|
Yaml
|
||||||
----
|
----
|
||||||
|
@ -233,7 +233,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
$workflows = [];
|
$workflows = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 === \count($workflows) && isset($workflows['workflows']) && array_keys($workflows['workflows']) !== range(0, \count($workflows) - 1) && !empty(array_diff(array_keys($workflows['workflows']), ['audit_trail', 'type', 'marking_store', 'supports', 'support_strategy', 'initial_places', 'places', 'transitions']))) {
|
if (1 === \count($workflows) && isset($workflows['workflows']) && array_keys($workflows['workflows']) !== range(0, \count($workflows) - 1) && !empty(array_diff(array_keys($workflows['workflows']), ['audit_trail', 'type', 'marking_store', 'supports', 'support_strategy', 'initial_marking', 'places', 'transitions']))) {
|
||||||
$workflows = $workflows['workflows'];
|
$workflows = $workflows['workflows'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,9 +258,17 @@ class Configuration implements ConfigurationInterface
|
|||||||
->arrayNode('workflows')
|
->arrayNode('workflows')
|
||||||
->useAttributeAsKey('name')
|
->useAttributeAsKey('name')
|
||||||
->prototype('array')
|
->prototype('array')
|
||||||
|
->beforeNormalization()
|
||||||
|
->always(function ($v) {
|
||||||
|
if (isset($v['initial_place'])) {
|
||||||
|
$v['initial_marking'] = [$v['initial_place']];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $v;
|
||||||
|
})
|
||||||
|
->end()
|
||||||
->fixXmlConfig('support')
|
->fixXmlConfig('support')
|
||||||
->fixXmlConfig('place')
|
->fixXmlConfig('place')
|
||||||
->fixXmlConfig('initial_place')
|
|
||||||
->fixXmlConfig('transition')
|
->fixXmlConfig('transition')
|
||||||
->children()
|
->children()
|
||||||
->arrayNode('audit_trail')
|
->arrayNode('audit_trail')
|
||||||
@ -274,9 +282,11 @@ class Configuration implements ConfigurationInterface
|
|||||||
->fixXmlConfig('argument')
|
->fixXmlConfig('argument')
|
||||||
->children()
|
->children()
|
||||||
->enumNode('type')
|
->enumNode('type')
|
||||||
|
->setDeprecated('The "%path%.%node%" configuration key has been deprecated in Symfony 4.3. Use "method" instead as it will be the only option in Symfony 5.0.')
|
||||||
->values(['multiple_state', 'single_state', 'method'])
|
->values(['multiple_state', 'single_state', 'method'])
|
||||||
->end()
|
->end()
|
||||||
->arrayNode('arguments')
|
->arrayNode('arguments')
|
||||||
|
->setDeprecated('The "%path%.%node%" configuration key has been deprecated in Symfony 4.3. Use "property" instead.')
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->ifString()
|
->ifString()
|
||||||
->then(function ($v) { return [$v]; })
|
->then(function ($v) { return [$v]; })
|
||||||
@ -285,6 +295,9 @@ class Configuration implements ConfigurationInterface
|
|||||||
->prototype('scalar')
|
->prototype('scalar')
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
|
->scalarNode('property')
|
||||||
|
->defaultNull()
|
||||||
|
->end()
|
||||||
->scalarNode('service')
|
->scalarNode('service')
|
||||||
->cannotBeEmpty()
|
->cannotBeEmpty()
|
||||||
->end()
|
->end()
|
||||||
@ -297,6 +310,10 @@ class Configuration implements ConfigurationInterface
|
|||||||
->ifTrue(function ($v) { return !empty($v['arguments']) && isset($v['service']); })
|
->ifTrue(function ($v) { return !empty($v['arguments']) && isset($v['service']); })
|
||||||
->thenInvalid('"arguments" and "service" cannot be used together.')
|
->thenInvalid('"arguments" and "service" cannot be used together.')
|
||||||
->end()
|
->end()
|
||||||
|
->validate()
|
||||||
|
->ifTrue(function ($v) { return !empty($v['property']) && isset($v['service']); })
|
||||||
|
->thenInvalid('"property" and "service" cannot be used together.')
|
||||||
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->arrayNode('supports')
|
->arrayNode('supports')
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
@ -315,10 +332,10 @@ class Configuration implements ConfigurationInterface
|
|||||||
->cannotBeEmpty()
|
->cannotBeEmpty()
|
||||||
->end()
|
->end()
|
||||||
->scalarNode('initial_place')
|
->scalarNode('initial_place')
|
||||||
->setDeprecated('The "%path%.%node%" configuration key has been deprecated in Symfony 4.3, use the "initial_places" configuration key instead.')
|
->setDeprecated('The "%path%.%node%" configuration key has been deprecated in Symfony 4.3, use the "initial_marking" configuration key instead.')
|
||||||
->defaultNull()
|
->defaultNull()
|
||||||
->end()
|
->end()
|
||||||
->arrayNode('initial_places')
|
->arrayNode('initial_marking')
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->ifTrue(function ($v) { return !\is_array($v); })
|
->ifTrue(function ($v) { return !\is_array($v); })
|
||||||
->then(function ($v) { return [$v]; })
|
->then(function ($v) { return [$v]; })
|
||||||
|
@ -631,14 +631,14 @@ class FrameworkExtension extends Extension
|
|||||||
|
|
||||||
// Create places
|
// Create places
|
||||||
$places = array_column($workflow['places'], 'name');
|
$places = array_column($workflow['places'], 'name');
|
||||||
$initialPlaces = $workflow['initial_places'] ?? $workflow['initial_place'] ?? [];
|
$initialMarking = $workflow['initial_marking'] ?? $workflow['initial_place'] ?? [];
|
||||||
|
|
||||||
// Create a Definition
|
// Create a Definition
|
||||||
$definitionDefinition = new Definition(Workflow\Definition::class);
|
$definitionDefinition = new Definition(Workflow\Definition::class);
|
||||||
$definitionDefinition->setPublic(false);
|
$definitionDefinition->setPublic(false);
|
||||||
$definitionDefinition->addArgument($places);
|
$definitionDefinition->addArgument($places);
|
||||||
$definitionDefinition->addArgument($transitions);
|
$definitionDefinition->addArgument($transitions);
|
||||||
$definitionDefinition->addArgument($initialPlaces);
|
$definitionDefinition->addArgument($initialMarking);
|
||||||
$definitionDefinition->addArgument($metadataStoreDefinition);
|
$definitionDefinition->addArgument($metadataStoreDefinition);
|
||||||
|
|
||||||
// Create MarkingStore
|
// Create MarkingStore
|
||||||
@ -647,6 +647,12 @@ class FrameworkExtension extends Extension
|
|||||||
foreach ($workflow['marking_store']['arguments'] as $argument) {
|
foreach ($workflow['marking_store']['arguments'] as $argument) {
|
||||||
$markingStoreDefinition->addArgument($argument);
|
$markingStoreDefinition->addArgument($argument);
|
||||||
}
|
}
|
||||||
|
if ('method' === $workflow['marking_store']['type']) {
|
||||||
|
$markingStoreDefinition->setArguments([
|
||||||
|
'state_machine' === $type, //single state
|
||||||
|
$workflow['marking_store']['property'] ?? 'marking',
|
||||||
|
]);
|
||||||
|
}
|
||||||
} elseif (isset($workflow['marking_store']['service'])) {
|
} elseif (isset($workflow['marking_store']['service'])) {
|
||||||
$markingStoreDefinition = new Reference($workflow['marking_store']['service']);
|
$markingStoreDefinition = new Reference($workflow['marking_store']['service']);
|
||||||
}
|
}
|
||||||
@ -686,7 +692,7 @@ class FrameworkExtension extends Extension
|
|||||||
->addTransitions(array_map(function (Reference $ref) use ($container): Workflow\Transition {
|
->addTransitions(array_map(function (Reference $ref) use ($container): Workflow\Transition {
|
||||||
return $container->get((string) $ref);
|
return $container->get((string) $ref);
|
||||||
}, $transitions))
|
}, $transitions))
|
||||||
->setInitialPlace($initialPlaces)
|
->setInitialPlace($initialMarking)
|
||||||
->build()
|
->build()
|
||||||
;
|
;
|
||||||
$validator->validate($realDefinition, $name);
|
$validator->validate($realDefinition, $name);
|
||||||
|
@ -279,7 +279,7 @@
|
|||||||
|
|
||||||
<xsd:complexType name="workflow">
|
<xsd:complexType name="workflow">
|
||||||
<xsd:sequence>
|
<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" />
|
||||||
<xsd:element name="marking-store" type="marking_store" minOccurs="0" maxOccurs="1" />
|
<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="support" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
|
||||||
<xsd:element name="place" type="place" minOccurs="0" maxOccurs="unbounded" />
|
<xsd:element name="place" type="place" minOccurs="0" maxOccurs="unbounded" />
|
||||||
@ -289,6 +289,7 @@
|
|||||||
<xsd:attribute name="name" type="xsd:string" />
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
<xsd:attribute name="type" type="workflow_type" />
|
<xsd:attribute name="type" type="workflow_type" />
|
||||||
<xsd:attribute name="initial-place" type="xsd:string" />
|
<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="support-strategy" type="xsd:string" />
|
||||||
<xsd:attribute name="enabled" type="xsd:boolean" />
|
<xsd:attribute name="enabled" type="xsd:boolean" />
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
@ -304,12 +305,14 @@
|
|||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
<xsd:attribute name="type" type="marking_store_type" />
|
<xsd:attribute name="type" type="marking_store_type" />
|
||||||
<xsd:attribute name="service" type="xsd:string" />
|
<xsd:attribute name="service" type="xsd:string" />
|
||||||
|
<xsd:attribute name="property" type="xsd:string" />
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
|
|
||||||
<xsd:simpleType name="marking_store_type">
|
<xsd:simpleType name="marking_store_type">
|
||||||
<xsd:restriction base="xsd:string">
|
<xsd:restriction base="xsd:string">
|
||||||
<xsd:enumeration value="multiple_state" />
|
<xsd:enumeration value="multiple_state" />
|
||||||
<xsd:enumeration value="single_state" />
|
<xsd:enumeration value="single_state" />
|
||||||
|
<xsd:enumeration value="method" />
|
||||||
</xsd:restriction>
|
</xsd:restriction>
|
||||||
</xsd:simpleType>
|
</xsd:simpleType>
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest;
|
|
||||||
|
|
||||||
$container->loadFromExtension('framework', [
|
$container->loadFromExtension('framework', [
|
||||||
'workflows' => [
|
'workflows' => [
|
||||||
'legacy' => [
|
'legacy' => [
|
||||||
|
@ -6,7 +6,7 @@ $container->loadFromExtension('framework', [
|
|||||||
'workflows' => [
|
'workflows' => [
|
||||||
'my_workflow' => [
|
'my_workflow' => [
|
||||||
'marking_store' => [
|
'marking_store' => [
|
||||||
'type' => 'multiple_state',
|
'type' => 'method',
|
||||||
'service' => 'workflow_service',
|
'service' => 'workflow_service',
|
||||||
],
|
],
|
||||||
'supports' => [
|
'supports' => [
|
@ -6,13 +6,10 @@ $container->loadFromExtension('framework', [
|
|||||||
'workflows' => [
|
'workflows' => [
|
||||||
'article' => [
|
'article' => [
|
||||||
'type' => 'workflow',
|
'type' => 'workflow',
|
||||||
'marking_store' => [
|
|
||||||
'type' => 'multiple_state',
|
|
||||||
],
|
|
||||||
'supports' => [
|
'supports' => [
|
||||||
FrameworkExtensionTest::class,
|
FrameworkExtensionTest::class,
|
||||||
],
|
],
|
||||||
'initial_places' => ['draft'],
|
'initial_marking' => ['draft'],
|
||||||
'places' => [
|
'places' => [
|
||||||
'draft',
|
'draft',
|
||||||
'wait_for_journalist',
|
'wait_for_journalist',
|
||||||
|
@ -6,13 +6,10 @@ $container->loadFromExtension('framework', [
|
|||||||
'workflows' => [
|
'workflows' => [
|
||||||
'article' => [
|
'article' => [
|
||||||
'type' => 'workflow',
|
'type' => 'workflow',
|
||||||
'marking_store' => [
|
|
||||||
'type' => 'multiple_state',
|
|
||||||
],
|
|
||||||
'supports' => [
|
'supports' => [
|
||||||
FrameworkExtensionTest::class,
|
FrameworkExtensionTest::class,
|
||||||
],
|
],
|
||||||
'initial_places' => ['draft'],
|
'initial_marking' => ['draft'],
|
||||||
'places' => [
|
'places' => [
|
||||||
'draft',
|
'draft',
|
||||||
'wait_for_journalist',
|
'wait_for_journalist',
|
||||||
|
@ -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',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
@ -5,9 +5,7 @@ use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionT
|
|||||||
$container->loadFromExtension('framework', [
|
$container->loadFromExtension('framework', [
|
||||||
'workflows' => [
|
'workflows' => [
|
||||||
'my_workflow' => [
|
'my_workflow' => [
|
||||||
'marking_store' => [
|
'type' => 'workflow',
|
||||||
'type' => 'multiple_state',
|
|
||||||
],
|
|
||||||
'supports' => [
|
'supports' => [
|
||||||
FrameworkExtensionTest::class,
|
FrameworkExtensionTest::class,
|
||||||
],
|
],
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest;
|
|
||||||
|
|
||||||
$container->loadFromExtension('framework', [
|
$container->loadFromExtension('framework', [
|
||||||
'workflows' => [
|
'workflows' => [
|
||||||
'my_workflow' => [
|
'my_workflow' => [
|
||||||
'marking_store' => [
|
'type' => 'workflow',
|
||||||
'type' => 'multiple_state',
|
|
||||||
],
|
|
||||||
'places' => [
|
'places' => [
|
||||||
'first',
|
'first',
|
||||||
'last',
|
'last',
|
||||||
|
@ -6,13 +6,10 @@ $container->loadFromExtension('framework', [
|
|||||||
'workflows' => [
|
'workflows' => [
|
||||||
'article' => [
|
'article' => [
|
||||||
'type' => 'workflow',
|
'type' => 'workflow',
|
||||||
'marking_store' => [
|
|
||||||
'type' => 'multiple_state',
|
|
||||||
],
|
|
||||||
'supports' => [
|
'supports' => [
|
||||||
FrameworkExtensionTest::class,
|
FrameworkExtensionTest::class,
|
||||||
],
|
],
|
||||||
'initial_places' => ['draft'],
|
'initial_marking' => ['draft'],
|
||||||
'places' => [
|
'places' => [
|
||||||
'draft',
|
'draft',
|
||||||
'wait_for_journalist',
|
'wait_for_journalist',
|
||||||
@ -41,13 +38,10 @@ $container->loadFromExtension('framework', [
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
'pull_request' => [
|
'pull_request' => [
|
||||||
'marking_store' => [
|
|
||||||
'type' => 'single_state',
|
|
||||||
],
|
|
||||||
'supports' => [
|
'supports' => [
|
||||||
FrameworkExtensionTest::class,
|
FrameworkExtensionTest::class,
|
||||||
],
|
],
|
||||||
'initial_places' => ['start'],
|
'initial_marking' => 'start',
|
||||||
'metadata' => [
|
'metadata' => [
|
||||||
'title' => 'workflow title',
|
'title' => 'workflow title',
|
||||||
],
|
],
|
||||||
|
@ -6,7 +6,7 @@ $container->loadFromExtension('framework', [
|
|||||||
'foo' => [
|
'foo' => [
|
||||||
'type' => 'workflow',
|
'type' => 'workflow',
|
||||||
'supports' => ['Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest'],
|
'supports' => ['Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest'],
|
||||||
'initial_places' => ['bar'],
|
'initial_marking' => ['bar'],
|
||||||
'places' => ['bar', 'baz'],
|
'places' => ['bar', 'baz'],
|
||||||
'transitions' => [
|
'transitions' => [
|
||||||
'bar_baz' => [
|
'bar_baz' => [
|
||||||
|
@ -6,7 +6,7 @@ $container->loadFromExtension('framework', [
|
|||||||
'workflows' => [
|
'workflows' => [
|
||||||
'type' => 'workflow',
|
'type' => 'workflow',
|
||||||
'supports' => ['Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest'],
|
'supports' => ['Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest'],
|
||||||
'initial_places' => ['bar'],
|
'initial_marking' => ['bar'],
|
||||||
'places' => ['bar', 'baz'],
|
'places' => ['bar', 'baz'],
|
||||||
'transitions' => [
|
'transitions' => [
|
||||||
'bar_baz' => [
|
'bar_baz' => [
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
<framework:config>
|
<framework:config>
|
||||||
<framework:workflow name="legacy" type="workflow" initial-place="draft">
|
<framework:workflow name="legacy" type="workflow" initial-place="draft">
|
||||||
<framework:support>stdClass</framework:support>
|
<framework:support>stdClass</framework:support>
|
||||||
<framework:place name="draft"></framework:place>
|
<framework:place name="draft" />
|
||||||
<framework:place name="published"></framework:place>
|
<framework:place name="published" />
|
||||||
<framework:transition name="publish">
|
<framework:transition name="publish">
|
||||||
<framework:from>draft</framework:from>
|
<framework:from>draft</framework:from>
|
||||||
<framework:to>published</framework:to>
|
<framework:to>published</framework:to>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<framework:config>
|
<framework:config>
|
||||||
<framework:workflow name="my_workflow">
|
<framework:workflow name="my_workflow">
|
||||||
<framework:marking-store type="multiple_state" service="workflow_service" />
|
<framework:marking-store type="method" service="workflow_service" />
|
||||||
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
|
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
|
||||||
<framework:place name="first" />
|
<framework:place name="first" />
|
||||||
<framework:place name="last" />
|
<framework:place name="last" />
|
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
<framework:config>
|
<framework:config>
|
||||||
<framework:workflow name="article" type="workflow">
|
<framework:workflow name="article" type="workflow">
|
||||||
<framework:initial-place>draft</framework:initial-place>
|
<framework:initial-marking>draft</framework:initial-marking>
|
||||||
<framework:marking-store type="multiple_state">
|
<framework:marking-store>
|
||||||
<framework:argument>a</framework:argument>
|
<framework:argument>a</framework:argument>
|
||||||
<framework:argument>a</framework:argument>
|
<framework:argument>a</framework:argument>
|
||||||
</framework:marking-store>
|
</framework:marking-store>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<framework:config>
|
<framework:config>
|
||||||
<framework:workflow name="article" type="workflow">
|
<framework:workflow name="article" type="workflow">
|
||||||
<framework:initial-place>draft</framework:initial-place>
|
<framework:initial-marking>draft</framework:initial-marking>
|
||||||
<framework:marking-store type="multiple_state">
|
<framework:marking-store type="multiple_state">
|
||||||
<framework:argument>a</framework:argument>
|
<framework:argument>a</framework:argument>
|
||||||
<framework:argument>a</framework:argument>
|
<framework:argument>a</framework:argument>
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
<?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 https://symfony.com/schema/dic/services/services-1.0.xsd
|
||||||
|
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
|
||||||
|
|
||||||
|
<framework:config>
|
||||||
|
<framework:workflow name="my_workflow">
|
||||||
|
<framework:marking-store property="multiple_state" service="workflow_service" />
|
||||||
|
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
|
||||||
|
<framework:place name="first" />
|
||||||
|
<framework:place name="last" />
|
||||||
|
<framework:transition name="foobar">
|
||||||
|
<framework:from>a</framework:from>
|
||||||
|
<framework:to>a</framework:to>
|
||||||
|
</framework:transition>
|
||||||
|
</framework:workflow>
|
||||||
|
</framework:config>
|
||||||
|
</container>
|
@ -7,8 +7,7 @@
|
|||||||
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
|
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
|
||||||
|
|
||||||
<framework:config>
|
<framework:config>
|
||||||
<framework:workflow name="my_workflow" support-strategy="foobar">
|
<framework:workflow name="my_workflow" support-strategy="foobar" type="workflow">
|
||||||
<framework:marking-store type="multiple_state"/>
|
|
||||||
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
|
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
|
||||||
<framework:place name="first" />
|
<framework:place name="first" />
|
||||||
<framework:place name="last" />
|
<framework:place name="last" />
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
|
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
|
||||||
|
|
||||||
<framework:config>
|
<framework:config>
|
||||||
<framework:workflow name="my_workflow">
|
<framework:workflow name="my_workflow" type="workflow">
|
||||||
<framework:marking-store type="multiple_state"/>
|
|
||||||
<framework:place name="first" />
|
<framework:place name="first" />
|
||||||
<framework:place name="last" />
|
<framework:place name="last" />
|
||||||
<framework:transition name="foobar">
|
<framework:transition name="foobar">
|
||||||
|
@ -8,18 +8,18 @@
|
|||||||
|
|
||||||
<framework:config>
|
<framework:config>
|
||||||
<framework:workflow name="article" type="workflow">
|
<framework:workflow name="article" type="workflow">
|
||||||
<framework:initial-place>draft</framework:initial-place>
|
<framework:initial-marking>draft</framework:initial-marking>
|
||||||
<framework:marking-store type="multiple_state">
|
<framework:marking-store type="multiple_state">
|
||||||
<framework:argument>a</framework:argument>
|
<framework:argument>a</framework:argument>
|
||||||
<framework:argument>a</framework:argument>
|
<framework:argument>a</framework:argument>
|
||||||
</framework:marking-store>
|
</framework:marking-store>
|
||||||
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
|
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
|
||||||
<framework:place name="draft"></framework:place>
|
<framework:place name="draft" />
|
||||||
<framework:place name="wait_for_journalist"></framework:place>
|
<framework:place name="wait_for_journalist" />
|
||||||
<framework:place name="approved_by_journalist"></framework:place>
|
<framework:place name="approved_by_journalist" />
|
||||||
<framework:place name="wait_for_spellchecker"></framework:place>
|
<framework:place name="wait_for_spellchecker" />
|
||||||
<framework:place name="approved_by_spellchecker"></framework:place>
|
<framework:place name="approved_by_spellchecker" />
|
||||||
<framework:place name="published"></framework:place>
|
<framework:place name="published" />
|
||||||
<framework:transition name="request_review">
|
<framework:transition name="request_review">
|
||||||
<framework:from>draft</framework:from>
|
<framework:from>draft</framework:from>
|
||||||
<framework:to>wait_for_journalist</framework:to>
|
<framework:to>wait_for_journalist</framework:to>
|
||||||
@ -40,8 +40,8 @@
|
|||||||
</framework:transition>
|
</framework:transition>
|
||||||
</framework:workflow>
|
</framework:workflow>
|
||||||
|
|
||||||
<framework:workflow name="pull_request" initial-place="start">
|
<framework:workflow name="pull_request">
|
||||||
<framework:marking-store type="single_state"/>
|
<framework:initial-marking>start</framework:initial-marking>
|
||||||
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
|
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
|
||||||
<framework:place name="start">
|
<framework:place name="start">
|
||||||
<framework:metadata>
|
<framework:metadata>
|
||||||
|
@ -6,8 +6,7 @@
|
|||||||
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
|
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
|
||||||
|
|
||||||
<framework:config>
|
<framework:config>
|
||||||
<framework:workflow enabled="true" name="foo" type="workflow">
|
<framework:workflow enabled="true" name="foo" type="workflow" initial-marking="start">
|
||||||
<framework:initial-place>bar</framework:initial-place>
|
|
||||||
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
|
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
|
||||||
<framework:place>bar</framework:place>
|
<framework:place>bar</framework:place>
|
||||||
<framework:place>baz</framework:place>
|
<framework:place>baz</framework:place>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<framework:config>
|
<framework:config>
|
||||||
<framework:workflow enabled="true" name="workflows" type="workflow">
|
<framework:workflow enabled="true" name="workflows" type="workflow">
|
||||||
<framework:initial-place>bar</framework:initial-place>
|
<framework:initial-marking>bar</framework:initial-marking>
|
||||||
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
|
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
|
||||||
<framework:place>bar</framework:place>
|
<framework:place>bar</framework:place>
|
||||||
<framework:place>baz</framework:place>
|
<framework:place>baz</framework:place>
|
||||||
|
@ -2,7 +2,7 @@ framework:
|
|||||||
workflows:
|
workflows:
|
||||||
my_workflow:
|
my_workflow:
|
||||||
marking_store:
|
marking_store:
|
||||||
type: multiple_state
|
type: method
|
||||||
service: workflow_service
|
service: workflow_service
|
||||||
supports:
|
supports:
|
||||||
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
@ -2,18 +2,16 @@ framework:
|
|||||||
workflows:
|
workflows:
|
||||||
article:
|
article:
|
||||||
type: workflow
|
type: workflow
|
||||||
marking_store:
|
|
||||||
type: multiple_state
|
|
||||||
supports:
|
supports:
|
||||||
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
||||||
initial_places: [draft]
|
initial_marking: [draft]
|
||||||
places:
|
places:
|
||||||
- draft
|
- draft
|
||||||
- wait_for_journalist
|
- wait_for_journalist
|
||||||
- approved_by_journalist
|
- approved_by_journalist
|
||||||
- wait_for_spellchecker
|
- wait_for_spellchecker
|
||||||
- approved_by_spellchecker
|
- approved_by_spellchecker
|
||||||
- published
|
- published
|
||||||
transitions:
|
transitions:
|
||||||
request_review:
|
request_review:
|
||||||
from: [draft]
|
from: [draft]
|
||||||
|
@ -2,11 +2,9 @@ framework:
|
|||||||
workflows:
|
workflows:
|
||||||
article:
|
article:
|
||||||
type: workflow
|
type: workflow
|
||||||
marking_store:
|
|
||||||
type: multiple_state
|
|
||||||
supports:
|
supports:
|
||||||
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
||||||
initial_places: [draft]
|
initial_marking: [draft]
|
||||||
places:
|
places:
|
||||||
- draft
|
- draft
|
||||||
- wait_for_journalist
|
- wait_for_journalist
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
framework:
|
||||||
|
workflows:
|
||||||
|
my_workflow:
|
||||||
|
marking_store:
|
||||||
|
property: state
|
||||||
|
service: workflow_service
|
||||||
|
supports:
|
||||||
|
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
||||||
|
places:
|
||||||
|
- first
|
||||||
|
- last
|
||||||
|
transitions:
|
||||||
|
go:
|
||||||
|
from:
|
||||||
|
- first
|
||||||
|
to:
|
||||||
|
- last
|
@ -1,8 +1,7 @@
|
|||||||
framework:
|
framework:
|
||||||
workflows:
|
workflows:
|
||||||
my_workflow:
|
my_workflow:
|
||||||
marking_store:
|
type: workflow
|
||||||
type: multiple_state
|
|
||||||
supports:
|
supports:
|
||||||
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
||||||
support_strategy: foobar
|
support_strategy: foobar
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
framework:
|
framework:
|
||||||
workflows:
|
workflows:
|
||||||
my_workflow:
|
my_workflow:
|
||||||
marking_store:
|
type: workflow
|
||||||
type: multiple_state
|
|
||||||
places:
|
places:
|
||||||
- first
|
- first
|
||||||
- last
|
- last
|
||||||
|
@ -2,11 +2,9 @@ framework:
|
|||||||
workflows:
|
workflows:
|
||||||
article:
|
article:
|
||||||
type: workflow
|
type: workflow
|
||||||
marking_store:
|
|
||||||
type: multiple_state
|
|
||||||
supports:
|
supports:
|
||||||
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
||||||
initial_places: [draft]
|
initial_marking: [draft]
|
||||||
places:
|
places:
|
||||||
# simple format
|
# simple format
|
||||||
- draft
|
- draft
|
||||||
@ -29,11 +27,9 @@ framework:
|
|||||||
from: [approved_by_journalist, approved_by_spellchecker]
|
from: [approved_by_journalist, approved_by_spellchecker]
|
||||||
to: [published]
|
to: [published]
|
||||||
pull_request:
|
pull_request:
|
||||||
marking_store:
|
|
||||||
type: single_state
|
|
||||||
supports:
|
supports:
|
||||||
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
||||||
initial_places: [start]
|
initial_marking: start
|
||||||
metadata:
|
metadata:
|
||||||
title: workflow title
|
title: workflow title
|
||||||
places:
|
places:
|
||||||
|
@ -6,7 +6,7 @@ framework:
|
|||||||
type: workflow
|
type: workflow
|
||||||
supports:
|
supports:
|
||||||
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
||||||
initial_places: [bar]
|
initial_marking: [bar]
|
||||||
places:
|
places:
|
||||||
- bar
|
- bar
|
||||||
- baz
|
- baz
|
||||||
|
@ -5,7 +5,7 @@ framework:
|
|||||||
type: workflow
|
type: workflow
|
||||||
supports:
|
supports:
|
||||||
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
|
||||||
initial_places: [bar]
|
initial_marking: [bar]
|
||||||
places:
|
places:
|
||||||
- bar
|
- bar
|
||||||
- baz
|
- baz
|
||||||
|
@ -307,12 +307,23 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||||
|
* @expectedExceptionMessage "property" and "service" cannot be used together.
|
||||||
|
*/
|
||||||
|
public function testWorkflowCannotHaveBothPropertyAndService()
|
||||||
|
{
|
||||||
|
$this->createContainerFromFile('workflow_with_property_and_service');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @legacy
|
||||||
|
*
|
||||||
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||||
* @expectedExceptionMessage "type" and "service" cannot be used together.
|
* @expectedExceptionMessage "type" and "service" cannot be used together.
|
||||||
*/
|
*/
|
||||||
public function testWorkflowCannotHaveBothTypeAndService()
|
public function testWorkflowCannotHaveBothTypeAndService()
|
||||||
{
|
{
|
||||||
$this->createContainerFromFile('workflow_with_type_and_service');
|
$this->createContainerFromFile('workflow_legacy_with_type_and_service');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -339,7 +350,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testWorkflowCannotHaveBothArgumentsAndService()
|
public function testWorkflowCannotHaveBothArgumentsAndService()
|
||||||
{
|
{
|
||||||
$this->createContainerFromFile('workflow_with_arguments_and_service');
|
$this->createContainerFromFile('workflow_legacy_with_arguments_and_service');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWorkflowMultipleTransitionsWithSameName()
|
public function testWorkflowMultipleTransitionsWithSameName()
|
||||||
|
Reference in New Issue
Block a user