Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -473,27 +473,16 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode): void
throw new InvalidConfigurationException('The "places" option must be an array in workflow configuration.');
}

// It's an indexed array of shape ['place1', 'place2']
if (isset($places[0]) && \is_string($places[0])) {
return array_map(function (string $place) {
return ['name' => $place];
}, $places);
}

// It's an indexed array, we let the validation occur
if (isset($places[0]) && \is_array($places[0])) {
return $places;
}

foreach ($places as $name => $place) {
if (\is_array($place) && \array_key_exists('name', $place)) {
continue;
$normalizedPlaces = [];
foreach ($places as $key => $value) {
if (!\is_array($value)) {
$value = ['name' => $value];
}
$place['name'] = $name;
$places[$name] = $place;
$value['name'] ??= $key;
$normalizedPlaces[] = $value;
}

return array_values($places);
return $normalizedPlaces;
})
->end()
->isRequired()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase;

$container->loadFromExtension('framework', [
'annotations' => false,
'http_method_override' => false,
'handle_all_throwables' => true,
'php_errors' => ['log' => true],
'workflows' => [
'article' => [
'type' => 'workflow',
'supports' => [
FrameworkExtensionTestCase::class,
],
'initial_marking' => ['draft'],
'metadata' => [
'title' => 'article workflow',
'description' => 'workflow for articles',
],
'places' => [
'draft' => [
'metadata' => [
'foo' => 'bar',
],
],
'wait_for_journalist',
'approved_by_journalist' => [
'name' => 'approved_by_journalist',
],
'wait_for_spellchecker',
'approved_by_spellchecker',
'published',
],
'transitions' => [
'request_review' => [
'from' => 'draft',
'to' => ['wait_for_journalist', 'wait_for_spellchecker'],
],
'journalist_approval' => [
'from' => 'wait_for_journalist',
'to' => 'approved_by_journalist',
],
'spellchecker_approval' => [
'from' => 'wait_for_spellchecker',
'to' => 'approved_by_spellchecker',
],
'publish' => [
'from' => ['approved_by_journalist', 'approved_by_spellchecker'],
'to' => 'published',
],
],
],
],
]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase;

$container->loadFromExtension('framework', [
'annotations' => false,
'http_method_override' => false,
'handle_all_throwables' => true,
'php_errors' => ['log' => true],
'workflows' => [
'article' => [
'type' => 'workflow',
'supports' => [
FrameworkExtensionTestCase::class,
],
'initial_marking' => ['draft'],
'metadata' => [
'title' => 'article workflow',
'description' => 'workflow for articles',
],
'places' => [
'draft',
'wait_for_journalist' => [
'metadata' => [
'description' => 'The article is awaiting approval of an authorized journalist.',
],
],
'approved_by_journalist' => [
'name' => 'approved_by_journalist',
],
'wait_for_spellchecker',
'approved_by_spellchecker',
'published',
],
'transitions' => [
'request_review' => [
'from' => 'draft',
'to' => ['wait_for_journalist', 'wait_for_spellchecker'],
],
'journalist_approval' => [
'from' => 'wait_for_journalist',
'to' => 'approved_by_journalist',
],
'spellchecker_approval' => [
'from' => 'wait_for_spellchecker',
'to' => 'approved_by_spellchecker',
],
'publish' => [
'from' => ['approved_by_journalist', 'approved_by_spellchecker'],
'to' => 'published',
],
],
],
],
]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xmlns="http://symfony.com/schema/dic/services"
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 http-method-override="false" handle-all-throwables="true">
<framework:annotations enabled="false"/>
<framework:php-errors log="true"/>
<framework:workflow name="article" type="workflow">
<framework:audit-trail enabled="true"/>
<framework:initial-marking>draft</framework:initial-marking>
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase</framework:support>
<framework:place name="draft">
<framework:metadata>
<framework:foo>bar</framework:foo>
</framework:metadata>
</framework:place>
<framework:place>wait_for_journalist</framework:place>
<framework:place name="approved_by_journalist"/>
<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_spellchecker</framework:from>
<framework:to>approved_by_spellchecker</framework:to>
</framework:transition>
<framework:transition name="publish">
<framework:from>approved_by_journalist</framework:from>
<framework:from>approved_by_spellchecker</framework:from>
<framework:to>published</framework:to>
</framework:transition>
<framework:metadata>
<framework:title>article workflow</framework:title>
<framework:description>workflow for articles</framework:description>
</framework:metadata>
</framework:workflow>
</framework:config>
</container>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xmlns="http://symfony.com/schema/dic/services"
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 http-method-override="false" handle-all-throwables="true">
<framework:annotations enabled="false"/>
<framework:php-errors log="true"/>
<framework:workflow name="article" type="workflow">
<framework:audit-trail enabled="true"/>
<framework:initial-marking>draft</framework:initial-marking>
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase</framework:support>
<framework:place>draft</framework:place>
<framework:place name="wait_for_journalist">
<framework:metadata>
<framework:description>The article is awaiting approval of an authorized journalist.</framework:description>
</framework:metadata>
</framework:place>
<framework:place name="approved_by_journalist"/>
<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_spellchecker</framework:from>
<framework:to>approved_by_spellchecker</framework:to>
</framework:transition>
<framework:transition name="publish">
<framework:from>approved_by_journalist</framework:from>
<framework:from>approved_by_spellchecker</framework:from>
<framework:to>published</framework:to>
</framework:transition>
<framework:metadata>
<framework:title>article workflow</framework:title>
<framework:description>workflow for articles</framework:description>
</framework:metadata>
</framework:workflow>
</framework:config>
</container>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
framework:
annotations: false
http_method_override: false
handle_all_throwables: true
php_errors:
log: true
workflows:
article:
type: workflow
supports:
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase
initial_marking: [ draft ]
metadata:
title: article workflow
description: workflow for articles
places:
draft:
metadata:
foo: bar
wait_for_journalist: ~
approved_by_journalist: ~
wait_for_spellchecker: ~
approved_by_spellchecker: ~
published: ~
transitions:
request_review:
from: [ draft ]
to: [ wait_for_journalist, wait_for_spellchecker ]
journalist_approval:
from: [ wait_for_journalist ]
to: [ approved_by_journalist ]
spellchecker_approval:
from: [ wait_for_spellchecker ]
to: [ approved_by_spellchecker ]
publish:
from: [ approved_by_journalist, approved_by_spellchecker ]
to: [ published ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
framework:
annotations: false
http_method_override: false
handle_all_throwables: true
php_errors:
log: true
workflows:
article:
type: workflow
supports:
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase
initial_marking: [ draft ]
metadata:
title: article workflow
description: workflow for articles
places:
- draft:
metadata:
foo: bar
- wait_for_journalist
- approved_by_journalist
- wait_for_spellchecker
- approved_by_spellchecker
- published
transitions:
request_review:
from: [ draft ]
to: [ wait_for_journalist, wait_for_spellchecker ]
journalist_approval:
from: [ wait_for_journalist ]
to: [ approved_by_journalist ]
spellchecker_approval:
from: [ wait_for_spellchecker ]
to: [ approved_by_spellchecker ]
publish:
from: [ approved_by_journalist, approved_by_spellchecker ]
to: [ published ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
framework:
annotations: false
http_method_override: false
handle_all_throwables: true
php_errors:
log: true
workflows:
article:
type: workflow
supports:
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase
initial_marking: [ draft ]
metadata:
title: article workflow
description: workflow for articles
places:
draft: ~
wait_for_journalist:
metadata:
description: The article is awaiting approval of an authorized journalist.
approved_by_journalist: ~
wait_for_spellchecker: ~
approved_by_spellchecker: ~
published: ~
transitions:
request_review:
from: [ draft ]
to: [ wait_for_journalist, wait_for_spellchecker ]
journalist_approval:
from: [ wait_for_journalist ]
to: [ approved_by_journalist ]
spellchecker_approval:
from: [ wait_for_spellchecker ]
to: [ approved_by_spellchecker ]
publish:
from: [ approved_by_journalist, approved_by_spellchecker ]
to: [ published ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
framework:
annotations: false
http_method_override: false
handle_all_throwables: true
php_errors:
log: true
workflows:
article:
type: workflow
supports:
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase
initial_marking: [ draft ]
metadata:
title: article workflow
description: workflow for articles
places:
- draft
- wait_for_journalist:
metadata:
description: The article is awaiting approval of an authorized journalist.
- approved_by_journalist
- wait_for_spellchecker
- approved_by_spellchecker
- published
transitions:
request_review:
from: [ draft ]
to: [ wait_for_journalist, wait_for_spellchecker ]
journalist_approval:
from: [ wait_for_journalist ]
to: [ approved_by_journalist ]
spellchecker_approval:
from: [ wait_for_spellchecker ]
to: [ approved_by_spellchecker ]
publish:
from: [ approved_by_journalist, approved_by_spellchecker ]
to: [ published ]
Loading
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.