Skip to content

Commit eb14981

Browse files
committed
minor symfony#20462 [Workfow] Rename current MarkingStore (lyrixx)
This PR was merged into the 3.2-dev branch. Discussion ---------- [Workfow] Rename current MarkingStore | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | yes (in un-released branch) | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - * ScalarMarkingStore -> SingleStateMarkingStore * PropertyAccessorMarkingStore -> MultipleStateMarkingStore And I also made optionnal the `marking_store` config, to let the componant choose the best marking store depending on the type (state_machine or workflow). --- Note: I did that to ease the on-boarding Commits ------- 08464c9 [Workfow] Rename current MarkingStore
2 parents 61b1334 + 08464c9 commit eb14981

File tree

14 files changed

+48
-38
lines changed

14 files changed

+48
-38
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,9 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
241241
->defaultValue('workflow')
242242
->end()
243243
->arrayNode('marking_store')
244-
->isRequired()
245244
->children()
246245
->enumNode('type')
247-
->values(array('property_accessor', 'scalar'))
246+
->values(array('multiple_state', 'single_state'))
248247
->end()
249248
->arrayNode('arguments')
250249
->beforeNormalization()

src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
<argument /> <!-- name -->
1919
</service>
2020

21-
<service id="workflow.marking_store.property_accessor" class="Symfony\Component\Workflow\MarkingStore\PropertyAccessorMarkingStore" abstract="true" />
22-
<service id="workflow.marking_store.scalar" class="Symfony\Component\Workflow\MarkingStore\ScalarMarkingStore" abstract="true" />
21+
<service id="workflow.marking_store.multiple_state" class="Symfony\Component\Workflow\MarkingStore\MultipleStateMarkingStore" abstract="true" />
22+
<service id="workflow.marking_store.single_state" class="Symfony\Component\Workflow\MarkingStore\SingleStateMarkingStore" abstract="true" />
2323

2424
<service id="workflow.registry" class="Symfony\Component\Workflow\Registry" />
2525

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
'workflows' => array(
77
'my_workflow' => array(
88
'marking_store' => array(
9-
'type' => 'property_accessor',
9+
'type' => 'multiple_state',
1010
),
1111
'supports' => array(
1212
FrameworkExtensionTest::class,

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflow.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<framework:workflows>
1111
<framework:workflow name="my_workflow">
1212
<framework:marking-store>
13-
<framework:type>property_accessor</framework:type>
13+
<framework:type>multiple_state</framework:type>
1414
<framework:arguments>a</framework:arguments>
1515
<framework:arguments>a</framework:arguments>
1616
</framework:marking-store>

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ framework:
22
workflows:
33
my_workflow:
44
marking_store:
5-
type: property_accessor
5+
type: multiple_state
66
supports:
77
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
88
places:

src/Symfony/Component/Workflow/MarkingStore/MarkingStoreInterface.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
use Symfony\Component\Workflow\Marking;
1515

1616
/**
17-
* MarkingStoreInterface.
17+
* MarkingStoreInterface is the interface between the Workflow Component and a
18+
* plain old PHP object: the subject.
19+
*
20+
* It converts the Marking into something understandable by the subject and vice
21+
* versa.
1822
*
1923
* @author Grégoire Pineau <[email protected]>
2024
*/

src/Symfony/Component/Workflow/MarkingStore/PropertyAccessorMarkingStore.php renamed to src/Symfony/Component/Workflow/MarkingStore/MultipleStateMarkingStore.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,21 @@
1616
use Symfony\Component\Workflow\Marking;
1717

1818
/**
19-
* PropertyAccessorMarkingStore.
19+
* MultipleStateMarkingStore stores the marking into a property of the
20+
* subject.
21+
*
22+
* This store deals with a "multiple state" Marking. It means a subject can be
23+
* in many state at the same time.
2024
*
2125
* @author Grégoire Pineau <[email protected]>
2226
*/
23-
class PropertyAccessorMarkingStore implements MarkingStoreInterface
27+
class MultipleStateMarkingStore implements MarkingStoreInterface
2428
{
2529
private $property;
2630
private $propertyAccessor;
2731

2832
/**
29-
* PropertyAccessorMarkingStore constructor.
33+
* MultipleStateMarkingStore constructor.
3034
*
3135
* @param string $property
3236
* @param PropertyAccessorInterface|null $propertyAccessor

src/Symfony/Component/Workflow/MarkingStore/ScalarMarkingStore.php renamed to src/Symfony/Component/Workflow/MarkingStore/SingleStateMarkingStore.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,20 @@
1616
use Symfony\Component\Workflow\Marking;
1717

1818
/**
19-
* ScalarMarkingStore.
19+
* SingleStateMarkingStore stores the marking into a property of the subject.
20+
*
21+
* This store deals with a "single state" Marking. It means a subject can be in
22+
* one and only state at the same time.
2023
*
2124
* @author Grégoire Pineau <[email protected]>
2225
*/
23-
class ScalarMarkingStore implements MarkingStoreInterface
26+
class SingleStateMarkingStore implements MarkingStoreInterface
2427
{
2528
private $property;
2629
private $propertyAccessor;
2730

2831
/**
29-
* ScalarMarkingStore constructor.
32+
* SingleStateMarkingStore constructor.
3033
*
3134
* @param string $property
3235
* @param PropertyAccessorInterface|null $propertyAccessor

src/Symfony/Component/Workflow/StateMachine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
66
use Symfony\Component\Workflow\MarkingStore\MarkingStoreInterface;
7-
use Symfony\Component\Workflow\MarkingStore\ScalarMarkingStore;
7+
use Symfony\Component\Workflow\MarkingStore\SingleStateMarkingStore;
88

99
/**
1010
* @author Tobias Nyholm <[email protected]>
@@ -13,6 +13,6 @@ class StateMachine extends Workflow
1313
{
1414
public function __construct(Definition $definition, MarkingStoreInterface $markingStore = null, EventDispatcherInterface $dispatcher = null, $name = 'unnamed')
1515
{
16-
parent::__construct($definition, $markingStore ?: new ScalarMarkingStore(), $dispatcher, $name);
16+
parent::__construct($definition, $markingStore ?: new SingleStateMarkingStore(), $dispatcher, $name);
1717
}
1818
}

src/Symfony/Component/Workflow/Tests/EventListener/AuditTrailListenerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Symfony\Component\EventDispatcher\EventDispatcher;
77
use Symfony\Component\Workflow\Definition;
88
use Symfony\Component\Workflow\EventListener\AuditTrailListener;
9-
use Symfony\Component\Workflow\MarkingStore\PropertyAccessorMarkingStore;
9+
use Symfony\Component\Workflow\MarkingStore\MultipleStateMarkingStore;
1010
use Symfony\Component\Workflow\Transition;
1111
use Symfony\Component\Workflow\Workflow;
1212

@@ -29,7 +29,7 @@ public function testItWorks()
2929
$ed = new EventDispatcher();
3030
$ed->addSubscriber(new AuditTrailListener($logger));
3131

32-
$workflow = new Workflow($definition, new PropertyAccessorMarkingStore(), $ed);
32+
$workflow = new Workflow($definition, new MultipleStateMarkingStore(), $ed);
3333

3434
$workflow->apply($object, 't1');
3535

0 commit comments

Comments
 (0)