Skip to content

Commit 1ddc6e0

Browse files
Merge branch '6.4' into 7.3
* 6.4: [FrameworkBundle] Normalize workflow places separately [Console] Don’t automatically append EOT to multiline test inputs [Validator] Review Albanian translations [Intl] Remove incorrect condition in CurrencyDataGenerator::icuPairToDate [Config] Fix `GlobResource` pattern with trailing slash
2 parents 19ec4ab + 890bc0b commit 1ddc6e0

11 files changed

+392
-18
lines changed

DependencyInjection/Configuration.php

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -499,27 +499,16 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode): void
499499
throw new InvalidConfigurationException('The "places" option must be an array in workflow configuration.');
500500
}
501501

502-
// It's an indexed array of shape ['place1', 'place2']
503-
if (isset($places[0]) && \is_string($places[0])) {
504-
return array_map(static function (string $place) {
505-
return ['name' => $place];
506-
}, $places);
507-
}
508-
509-
// It's an indexed array, we let the validation occur
510-
if (isset($places[0]) && \is_array($places[0])) {
511-
return $places;
512-
}
513-
514-
foreach ($places as $name => $place) {
515-
if (\is_array($place) && \array_key_exists('name', $place)) {
516-
continue;
502+
$normalizedPlaces = [];
503+
foreach ($places as $key => $value) {
504+
if (!\is_array($value)) {
505+
$value = ['name' => $value];
517506
}
518-
$place['name'] = $name;
519-
$places[$name] = $place;
507+
$value['name'] ??= $key;
508+
$normalizedPlaces[] = $value;
520509
}
521510

522-
return array_values($places);
511+
return $normalizedPlaces;
523512
})
524513
->end()
525514
->prototype('array')
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase;
4+
5+
$container->loadFromExtension('framework', [
6+
'annotations' => false,
7+
'http_method_override' => false,
8+
'handle_all_throwables' => true,
9+
'php_errors' => ['log' => true],
10+
'workflows' => [
11+
'article' => [
12+
'type' => 'workflow',
13+
'supports' => [
14+
FrameworkExtensionTestCase::class,
15+
],
16+
'initial_marking' => ['draft'],
17+
'metadata' => [
18+
'title' => 'article workflow',
19+
'description' => 'workflow for articles',
20+
],
21+
'places' => [
22+
'draft' => [
23+
'metadata' => [
24+
'foo' => 'bar',
25+
],
26+
],
27+
'wait_for_journalist',
28+
'approved_by_journalist' => [
29+
'name' => 'approved_by_journalist',
30+
],
31+
'wait_for_spellchecker',
32+
'approved_by_spellchecker',
33+
'published',
34+
],
35+
'transitions' => [
36+
'request_review' => [
37+
'from' => 'draft',
38+
'to' => ['wait_for_journalist', 'wait_for_spellchecker'],
39+
],
40+
'journalist_approval' => [
41+
'from' => 'wait_for_journalist',
42+
'to' => 'approved_by_journalist',
43+
],
44+
'spellchecker_approval' => [
45+
'from' => 'wait_for_spellchecker',
46+
'to' => 'approved_by_spellchecker',
47+
],
48+
'publish' => [
49+
'from' => ['approved_by_journalist', 'approved_by_spellchecker'],
50+
'to' => 'published',
51+
],
52+
],
53+
],
54+
],
55+
]);
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase;
4+
5+
$container->loadFromExtension('framework', [
6+
'annotations' => false,
7+
'http_method_override' => false,
8+
'handle_all_throwables' => true,
9+
'php_errors' => ['log' => true],
10+
'workflows' => [
11+
'article' => [
12+
'type' => 'workflow',
13+
'supports' => [
14+
FrameworkExtensionTestCase::class,
15+
],
16+
'initial_marking' => ['draft'],
17+
'metadata' => [
18+
'title' => 'article workflow',
19+
'description' => 'workflow for articles',
20+
],
21+
'places' => [
22+
'draft',
23+
'wait_for_journalist' => [
24+
'metadata' => [
25+
'description' => 'The article is awaiting approval of an authorized journalist.',
26+
],
27+
],
28+
'approved_by_journalist' => [
29+
'name' => 'approved_by_journalist',
30+
],
31+
'wait_for_spellchecker',
32+
'approved_by_spellchecker',
33+
'published',
34+
],
35+
'transitions' => [
36+
'request_review' => [
37+
'from' => 'draft',
38+
'to' => ['wait_for_journalist', 'wait_for_spellchecker'],
39+
],
40+
'journalist_approval' => [
41+
'from' => 'wait_for_journalist',
42+
'to' => 'approved_by_journalist',
43+
],
44+
'spellchecker_approval' => [
45+
'from' => 'wait_for_spellchecker',
46+
'to' => 'approved_by_spellchecker',
47+
],
48+
'publish' => [
49+
'from' => ['approved_by_journalist', 'approved_by_spellchecker'],
50+
'to' => 'published',
51+
],
52+
],
53+
],
54+
],
55+
]);
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<container xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns:framework="http://symfony.com/schema/dic/symfony"
4+
xmlns="http://symfony.com/schema/dic/services"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
7+
>
8+
<framework:config http-method-override="false" handle-all-throwables="true">
9+
<framework:annotations enabled="false"/>
10+
<framework:php-errors log="true"/>
11+
<framework:workflow name="article" type="workflow">
12+
<framework:audit-trail enabled="true"/>
13+
<framework:initial-marking>draft</framework:initial-marking>
14+
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase</framework:support>
15+
<framework:place name="draft">
16+
<framework:metadata>
17+
<framework:foo>bar</framework:foo>
18+
</framework:metadata>
19+
</framework:place>
20+
<framework:place>wait_for_journalist</framework:place>
21+
<framework:place name="approved_by_journalist"/>
22+
<framework:place>wait_for_spellchecker</framework:place>
23+
<framework:place>approved_by_spellchecker</framework:place>
24+
<framework:place>published</framework:place>
25+
<framework:transition name="request_review">
26+
<framework:from>draft</framework:from>
27+
<framework:to>wait_for_journalist</framework:to>
28+
<framework:to>wait_for_spellchecker</framework:to>
29+
</framework:transition>
30+
<framework:transition name="journalist_approval">
31+
<framework:from>wait_for_journalist</framework:from>
32+
<framework:to>approved_by_journalist</framework:to>
33+
</framework:transition>
34+
<framework:transition name="spellchecker_approval">
35+
<framework:from>wait_for_spellchecker</framework:from>
36+
<framework:to>approved_by_spellchecker</framework:to>
37+
</framework:transition>
38+
<framework:transition name="publish">
39+
<framework:from>approved_by_journalist</framework:from>
40+
<framework:from>approved_by_spellchecker</framework:from>
41+
<framework:to>published</framework:to>
42+
</framework:transition>
43+
<framework:metadata>
44+
<framework:title>article workflow</framework:title>
45+
<framework:description>workflow for articles</framework:description>
46+
</framework:metadata>
47+
</framework:workflow>
48+
</framework:config>
49+
</container>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<container xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns:framework="http://symfony.com/schema/dic/symfony"
4+
xmlns="http://symfony.com/schema/dic/services"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
7+
>
8+
<framework:config http-method-override="false" handle-all-throwables="true">
9+
<framework:annotations enabled="false"/>
10+
<framework:php-errors log="true"/>
11+
<framework:workflow name="article" type="workflow">
12+
<framework:audit-trail enabled="true"/>
13+
<framework:initial-marking>draft</framework:initial-marking>
14+
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase</framework:support>
15+
<framework:place>draft</framework:place>
16+
<framework:place name="wait_for_journalist">
17+
<framework:metadata>
18+
<framework:description>The article is awaiting approval of an authorized journalist.</framework:description>
19+
</framework:metadata>
20+
</framework:place>
21+
<framework:place name="approved_by_journalist"/>
22+
<framework:place>wait_for_spellchecker</framework:place>
23+
<framework:place>approved_by_spellchecker</framework:place>
24+
<framework:place>published</framework:place>
25+
<framework:transition name="request_review">
26+
<framework:from>draft</framework:from>
27+
<framework:to>wait_for_journalist</framework:to>
28+
<framework:to>wait_for_spellchecker</framework:to>
29+
</framework:transition>
30+
<framework:transition name="journalist_approval">
31+
<framework:from>wait_for_journalist</framework:from>
32+
<framework:to>approved_by_journalist</framework:to>
33+
</framework:transition>
34+
<framework:transition name="spellchecker_approval">
35+
<framework:from>wait_for_spellchecker</framework:from>
36+
<framework:to>approved_by_spellchecker</framework:to>
37+
</framework:transition>
38+
<framework:transition name="publish">
39+
<framework:from>approved_by_journalist</framework:from>
40+
<framework:from>approved_by_spellchecker</framework:from>
41+
<framework:to>published</framework:to>
42+
</framework:transition>
43+
<framework:metadata>
44+
<framework:title>article workflow</framework:title>
45+
<framework:description>workflow for articles</framework:description>
46+
</framework:metadata>
47+
</framework:workflow>
48+
</framework:config>
49+
</container>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
framework:
2+
annotations: false
3+
http_method_override: false
4+
handle_all_throwables: true
5+
php_errors:
6+
log: true
7+
workflows:
8+
article:
9+
type: workflow
10+
supports:
11+
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase
12+
initial_marking: [ draft ]
13+
metadata:
14+
title: article workflow
15+
description: workflow for articles
16+
places:
17+
draft:
18+
metadata:
19+
foo: bar
20+
wait_for_journalist: ~
21+
approved_by_journalist: ~
22+
wait_for_spellchecker: ~
23+
approved_by_spellchecker: ~
24+
published: ~
25+
transitions:
26+
request_review:
27+
from: [ draft ]
28+
to: [ wait_for_journalist, wait_for_spellchecker ]
29+
journalist_approval:
30+
from: [ wait_for_journalist ]
31+
to: [ approved_by_journalist ]
32+
spellchecker_approval:
33+
from: [ wait_for_spellchecker ]
34+
to: [ approved_by_spellchecker ]
35+
publish:
36+
from: [ approved_by_journalist, approved_by_spellchecker ]
37+
to: [ published ]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
framework:
2+
annotations: false
3+
http_method_override: false
4+
handle_all_throwables: true
5+
php_errors:
6+
log: true
7+
workflows:
8+
article:
9+
type: workflow
10+
supports:
11+
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase
12+
initial_marking: [ draft ]
13+
metadata:
14+
title: article workflow
15+
description: workflow for articles
16+
places:
17+
- draft:
18+
metadata:
19+
foo: bar
20+
- wait_for_journalist
21+
- approved_by_journalist
22+
- wait_for_spellchecker
23+
- approved_by_spellchecker
24+
- published
25+
transitions:
26+
request_review:
27+
from: [ draft ]
28+
to: [ wait_for_journalist, wait_for_spellchecker ]
29+
journalist_approval:
30+
from: [ wait_for_journalist ]
31+
to: [ approved_by_journalist ]
32+
spellchecker_approval:
33+
from: [ wait_for_spellchecker ]
34+
to: [ approved_by_spellchecker ]
35+
publish:
36+
from: [ approved_by_journalist, approved_by_spellchecker ]
37+
to: [ published ]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
framework:
2+
annotations: false
3+
http_method_override: false
4+
handle_all_throwables: true
5+
php_errors:
6+
log: true
7+
workflows:
8+
article:
9+
type: workflow
10+
supports:
11+
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase
12+
initial_marking: [ draft ]
13+
metadata:
14+
title: article workflow
15+
description: workflow for articles
16+
places:
17+
draft: ~
18+
wait_for_journalist:
19+
metadata:
20+
description: The article is awaiting approval of an authorized journalist.
21+
approved_by_journalist: ~
22+
wait_for_spellchecker: ~
23+
approved_by_spellchecker: ~
24+
published: ~
25+
transitions:
26+
request_review:
27+
from: [ draft ]
28+
to: [ wait_for_journalist, wait_for_spellchecker ]
29+
journalist_approval:
30+
from: [ wait_for_journalist ]
31+
to: [ approved_by_journalist ]
32+
spellchecker_approval:
33+
from: [ wait_for_spellchecker ]
34+
to: [ approved_by_spellchecker ]
35+
publish:
36+
from: [ approved_by_journalist, approved_by_spellchecker ]
37+
to: [ published ]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
framework:
2+
annotations: false
3+
http_method_override: false
4+
handle_all_throwables: true
5+
php_errors:
6+
log: true
7+
workflows:
8+
article:
9+
type: workflow
10+
supports:
11+
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase
12+
initial_marking: [ draft ]
13+
metadata:
14+
title: article workflow
15+
description: workflow for articles
16+
places:
17+
- draft
18+
- wait_for_journalist:
19+
metadata:
20+
description: The article is awaiting approval of an authorized journalist.
21+
- approved_by_journalist
22+
- wait_for_spellchecker
23+
- approved_by_spellchecker
24+
- published
25+
transitions:
26+
request_review:
27+
from: [ draft ]
28+
to: [ wait_for_journalist, wait_for_spellchecker ]
29+
journalist_approval:
30+
from: [ wait_for_journalist ]
31+
to: [ approved_by_journalist ]
32+
spellchecker_approval:
33+
from: [ wait_for_spellchecker ]
34+
to: [ approved_by_spellchecker ]
35+
publish:
36+
from: [ approved_by_journalist, approved_by_spellchecker ]
37+
to: [ published ]

0 commit comments

Comments
 (0)