diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
index 460e2a860f808..708e84ad1f766 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -241,10 +241,9 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
->defaultValue('workflow')
->end()
->arrayNode('marking_store')
- ->isRequired()
->children()
->enumNode('type')
- ->values(array('property_accessor', 'scalar'))
+ ->values(array('multiple_state', 'single_state'))
->end()
->arrayNode('arguments')
->beforeNormalization()
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml
index 1314be8b9f316..76592087a2260 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml
@@ -18,8 +18,8 @@
-
-
+
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow.php
index 7f29cc385ba5b..222299a9c09ac 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow.php
@@ -6,7 +6,7 @@
'workflows' => array(
'my_workflow' => array(
'marking_store' => array(
- 'type' => 'property_accessor',
+ 'type' => 'multiple_state',
),
'supports' => array(
FrameworkExtensionTest::class,
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflow.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflow.xml
index add799b82fd44..447b390f24be7 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflow.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflow.xml
@@ -10,7 +10,7 @@
- property_accessor
+ multiple_state
a
a
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/workflow.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/workflow.yml
index e9eb8e1977a9d..2bd071e568437 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/workflow.yml
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/workflow.yml
@@ -2,7 +2,7 @@ framework:
workflows:
my_workflow:
marking_store:
- type: property_accessor
+ type: multiple_state
supports:
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
places:
diff --git a/src/Symfony/Component/Workflow/MarkingStore/MarkingStoreInterface.php b/src/Symfony/Component/Workflow/MarkingStore/MarkingStoreInterface.php
index e73c9eb596c62..76df9cc0d2160 100644
--- a/src/Symfony/Component/Workflow/MarkingStore/MarkingStoreInterface.php
+++ b/src/Symfony/Component/Workflow/MarkingStore/MarkingStoreInterface.php
@@ -14,7 +14,11 @@
use Symfony\Component\Workflow\Marking;
/**
- * MarkingStoreInterface.
+ * MarkingStoreInterface is the interface between the Workflow Component and a
+ * plain old PHP object: the subject.
+ *
+ * It converts the Marking into something understandable by the subject and vice
+ * versa.
*
* @author Grégoire Pineau
*/
diff --git a/src/Symfony/Component/Workflow/MarkingStore/PropertyAccessorMarkingStore.php b/src/Symfony/Component/Workflow/MarkingStore/MultipleStateMarkingStore.php
similarity index 81%
rename from src/Symfony/Component/Workflow/MarkingStore/PropertyAccessorMarkingStore.php
rename to src/Symfony/Component/Workflow/MarkingStore/MultipleStateMarkingStore.php
index 8972b69b6c2e4..42fd65bb2c5d5 100644
--- a/src/Symfony/Component/Workflow/MarkingStore/PropertyAccessorMarkingStore.php
+++ b/src/Symfony/Component/Workflow/MarkingStore/MultipleStateMarkingStore.php
@@ -16,17 +16,21 @@
use Symfony\Component\Workflow\Marking;
/**
- * PropertyAccessorMarkingStore.
+ * MultipleStateMarkingStore stores the marking into a property of the
+ * subject.
+ *
+ * This store deals with a "multiple state" Marking. It means a subject can be
+ * in many state at the same time.
*
* @author Grégoire Pineau
*/
-class PropertyAccessorMarkingStore implements MarkingStoreInterface
+class MultipleStateMarkingStore implements MarkingStoreInterface
{
private $property;
private $propertyAccessor;
/**
- * PropertyAccessorMarkingStore constructor.
+ * MultipleStateMarkingStore constructor.
*
* @param string $property
* @param PropertyAccessorInterface|null $propertyAccessor
diff --git a/src/Symfony/Component/Workflow/MarkingStore/ScalarMarkingStore.php b/src/Symfony/Component/Workflow/MarkingStore/SingleStateMarkingStore.php
similarity index 82%
rename from src/Symfony/Component/Workflow/MarkingStore/ScalarMarkingStore.php
rename to src/Symfony/Component/Workflow/MarkingStore/SingleStateMarkingStore.php
index 1c7a36093b518..bbd2b74b6350e 100644
--- a/src/Symfony/Component/Workflow/MarkingStore/ScalarMarkingStore.php
+++ b/src/Symfony/Component/Workflow/MarkingStore/SingleStateMarkingStore.php
@@ -16,17 +16,20 @@
use Symfony\Component\Workflow\Marking;
/**
- * ScalarMarkingStore.
+ * SingleStateMarkingStore stores the marking into a property of the subject.
+ *
+ * This store deals with a "single state" Marking. It means a subject can be in
+ * one and only state at the same time.
*
* @author Grégoire Pineau
*/
-class ScalarMarkingStore implements MarkingStoreInterface
+class SingleStateMarkingStore implements MarkingStoreInterface
{
private $property;
private $propertyAccessor;
/**
- * ScalarMarkingStore constructor.
+ * SingleStateMarkingStore constructor.
*
* @param string $property
* @param PropertyAccessorInterface|null $propertyAccessor
diff --git a/src/Symfony/Component/Workflow/StateMachine.php b/src/Symfony/Component/Workflow/StateMachine.php
index 0c4e3edc0a6b5..00cfdac7d493a 100644
--- a/src/Symfony/Component/Workflow/StateMachine.php
+++ b/src/Symfony/Component/Workflow/StateMachine.php
@@ -4,7 +4,7 @@
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Workflow\MarkingStore\MarkingStoreInterface;
-use Symfony\Component\Workflow\MarkingStore\ScalarMarkingStore;
+use Symfony\Component\Workflow\MarkingStore\SingleStateMarkingStore;
/**
* @author Tobias Nyholm
@@ -13,6 +13,6 @@ class StateMachine extends Workflow
{
public function __construct(Definition $definition, MarkingStoreInterface $markingStore = null, EventDispatcherInterface $dispatcher = null, $name = 'unnamed')
{
- parent::__construct($definition, $markingStore ?: new ScalarMarkingStore(), $dispatcher, $name);
+ parent::__construct($definition, $markingStore ?: new SingleStateMarkingStore(), $dispatcher, $name);
}
}
diff --git a/src/Symfony/Component/Workflow/Tests/EventListener/AuditTrailListenerTest.php b/src/Symfony/Component/Workflow/Tests/EventListener/AuditTrailListenerTest.php
index 319a9119f5e02..c3982f1787608 100644
--- a/src/Symfony/Component/Workflow/Tests/EventListener/AuditTrailListenerTest.php
+++ b/src/Symfony/Component/Workflow/Tests/EventListener/AuditTrailListenerTest.php
@@ -6,7 +6,7 @@
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\EventListener\AuditTrailListener;
-use Symfony\Component\Workflow\MarkingStore\PropertyAccessorMarkingStore;
+use Symfony\Component\Workflow\MarkingStore\MultipleStateMarkingStore;
use Symfony\Component\Workflow\Transition;
use Symfony\Component\Workflow\Workflow;
@@ -29,7 +29,7 @@ public function testItWorks()
$ed = new EventDispatcher();
$ed->addSubscriber(new AuditTrailListener($logger));
- $workflow = new Workflow($definition, new PropertyAccessorMarkingStore(), $ed);
+ $workflow = new Workflow($definition, new MultipleStateMarkingStore(), $ed);
$workflow->apply($object, 't1');
diff --git a/src/Symfony/Component/Workflow/Tests/MarkingStore/PropertyAccessorMarkingStoreTest.php b/src/Symfony/Component/Workflow/Tests/MarkingStore/MultipleStateMarkingStoreTest.php
similarity index 75%
rename from src/Symfony/Component/Workflow/Tests/MarkingStore/PropertyAccessorMarkingStoreTest.php
rename to src/Symfony/Component/Workflow/Tests/MarkingStore/MultipleStateMarkingStoreTest.php
index 557a241689ece..7e324c530eff8 100644
--- a/src/Symfony/Component/Workflow/Tests/MarkingStore/PropertyAccessorMarkingStoreTest.php
+++ b/src/Symfony/Component/Workflow/Tests/MarkingStore/MultipleStateMarkingStoreTest.php
@@ -3,16 +3,16 @@
namespace Symfony\Component\Workflow\Tests\MarkingStore;
use Symfony\Component\Workflow\Marking;
-use Symfony\Component\Workflow\MarkingStore\PropertyAccessorMarkingStore;
+use Symfony\Component\Workflow\MarkingStore\MultipleStateMarkingStore;
-class PropertyAccessorMarkingStoreTest extends \PHPUnit_Framework_TestCase
+class MultipleStateMarkingStoreTest extends \PHPUnit_Framework_TestCase
{
public function testGetSetMarking()
{
$subject = new \stdClass();
$subject->myMarks = null;
- $markingStore = new PropertyAccessorMarkingStore('myMarks');
+ $markingStore = new MultipleStateMarkingStore('myMarks');
$marking = $markingStore->getMarking($subject);
diff --git a/src/Symfony/Component/Workflow/Tests/MarkingStore/ScalarMarkingStoreTest.php b/src/Symfony/Component/Workflow/Tests/MarkingStore/SingleStateMarkingStoreTest.php
similarity index 76%
rename from src/Symfony/Component/Workflow/Tests/MarkingStore/ScalarMarkingStoreTest.php
rename to src/Symfony/Component/Workflow/Tests/MarkingStore/SingleStateMarkingStoreTest.php
index df8d748a0d927..ad3fae189aca5 100644
--- a/src/Symfony/Component/Workflow/Tests/MarkingStore/ScalarMarkingStoreTest.php
+++ b/src/Symfony/Component/Workflow/Tests/MarkingStore/SingleStateMarkingStoreTest.php
@@ -3,16 +3,16 @@
namespace Symfony\Component\Workflow\Tests\MarkingStore;
use Symfony\Component\Workflow\Marking;
-use Symfony\Component\Workflow\MarkingStore\ScalarMarkingStore;
+use Symfony\Component\Workflow\MarkingStore\SingleStateMarkingStore;
-class ScalarMarkingStoreTest extends \PHPUnit_Framework_TestCase
+class SingleStateMarkingStoreTest extends \PHPUnit_Framework_TestCase
{
public function testGetSetMarking()
{
$subject = new \stdClass();
$subject->myMarks = null;
- $markingStore = new ScalarMarkingStore('myMarks');
+ $markingStore = new SingleStateMarkingStore('myMarks');
$marking = $markingStore->getMarking($subject);
diff --git a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php
index c926695270461..f5141c0fffba1 100644
--- a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php
+++ b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php
@@ -8,7 +8,7 @@
use Symfony\Component\Workflow\Event\GuardEvent;
use Symfony\Component\Workflow\Marking;
use Symfony\Component\Workflow\MarkingStore\MarkingStoreInterface;
-use Symfony\Component\Workflow\MarkingStore\PropertyAccessorMarkingStore;
+use Symfony\Component\Workflow\MarkingStore\MultipleStateMarkingStore;
use Symfony\Component\Workflow\Transition;
use Symfony\Component\Workflow\Workflow;
@@ -35,7 +35,7 @@ public function testGetMarkingWithEmptyDefinition()
{
$subject = new \stdClass();
$subject->marking = null;
- $workflow = new Workflow(new Definition(array(), array()), new PropertyAccessorMarkingStore());
+ $workflow = new Workflow(new Definition(array(), array()), new MultipleStateMarkingStore());
$workflow->getMarking($subject);
}
@@ -49,7 +49,7 @@ public function testGetMarkingWithImpossiblePlace()
$subject = new \stdClass();
$subject->marking = null;
$subject->marking = array('nope' => true);
- $workflow = new Workflow(new Definition(array(), array()), new PropertyAccessorMarkingStore());
+ $workflow = new Workflow(new Definition(array(), array()), new MultipleStateMarkingStore());
$workflow->getMarking($subject);
}
@@ -59,7 +59,7 @@ public function testGetMarkingWithEmptyInitialMarking()
$definition = $this->createComplexWorkflow();
$subject = new \stdClass();
$subject->marking = null;
- $workflow = new Workflow($definition, new PropertyAccessorMarkingStore());
+ $workflow = new Workflow($definition, new MultipleStateMarkingStore());
$marking = $workflow->getMarking($subject);
@@ -74,7 +74,7 @@ public function testGetMarkingWithExistingMarking()
$subject = new \stdClass();
$subject->marking = null;
$subject->marking = array('b' => 1, 'c' => 1);
- $workflow = new Workflow($definition, new PropertyAccessorMarkingStore());
+ $workflow = new Workflow($definition, new MultipleStateMarkingStore());
$marking = $workflow->getMarking($subject);
@@ -92,7 +92,7 @@ public function testCanWithUnexistingTransition()
$definition = $this->createComplexWorkflow();
$subject = new \stdClass();
$subject->marking = null;
- $workflow = new Workflow($definition, new PropertyAccessorMarkingStore());
+ $workflow = new Workflow($definition, new MultipleStateMarkingStore());
$workflow->can($subject, 'foobar');
}
@@ -102,7 +102,7 @@ public function testCan()
$definition = $this->createComplexWorkflow();
$subject = new \stdClass();
$subject->marking = null;
- $workflow = new Workflow($definition, new PropertyAccessorMarkingStore());
+ $workflow = new Workflow($definition, new MultipleStateMarkingStore());
$this->assertTrue($workflow->can($subject, 't1'));
$this->assertFalse($workflow->can($subject, 't2'));
@@ -117,7 +117,7 @@ public function testCanWithGuard()
$eventDispatcher->addListener('workflow.workflow_name.guard.t1', function (GuardEvent $event) {
$event->setBlocked(true);
});
- $workflow = new Workflow($definition, new PropertyAccessorMarkingStore(), $eventDispatcher, 'workflow_name');
+ $workflow = new Workflow($definition, new MultipleStateMarkingStore(), $eventDispatcher, 'workflow_name');
$this->assertFalse($workflow->can($subject, 't1'));
}
@@ -131,7 +131,7 @@ public function testApplyWithImpossibleTransition()
$definition = $this->createComplexWorkflow();
$subject = new \stdClass();
$subject->marking = null;
- $workflow = new Workflow($definition, new PropertyAccessorMarkingStore());
+ $workflow = new Workflow($definition, new MultipleStateMarkingStore());
$workflow->apply($subject, 't2');
}
@@ -141,7 +141,7 @@ public function testApply()
$definition = $this->createComplexWorkflow();
$subject = new \stdClass();
$subject->marking = null;
- $workflow = new Workflow($definition, new PropertyAccessorMarkingStore());
+ $workflow = new Workflow($definition, new MultipleStateMarkingStore());
$marking = $workflow->apply($subject, 't1');
@@ -157,7 +157,7 @@ public function testApplyWithEventDispatcher()
$subject = new \stdClass();
$subject->marking = null;
$eventDispatcher = new EventDispatcherMock();
- $workflow = new Workflow($definition, new PropertyAccessorMarkingStore(), $eventDispatcher, 'workflow_name');
+ $workflow = new Workflow($definition, new MultipleStateMarkingStore(), $eventDispatcher, 'workflow_name');
$eventNameExpected = array(
'workflow.guard',
@@ -194,7 +194,7 @@ public function testGetEnabledTransitions()
$eventDispatcher->addListener('workflow.workflow_name.guard.t1', function (GuardEvent $event) {
$event->setBlocked(true);
});
- $workflow = new Workflow($definition, new PropertyAccessorMarkingStore(), $eventDispatcher, 'workflow_name');
+ $workflow = new Workflow($definition, new MultipleStateMarkingStore(), $eventDispatcher, 'workflow_name');
$this->assertEmpty($workflow->getEnabledTransitions($subject));
diff --git a/src/Symfony/Component/Workflow/Workflow.php b/src/Symfony/Component/Workflow/Workflow.php
index 72dc07d73c79e..84cd9945d49cd 100644
--- a/src/Symfony/Component/Workflow/Workflow.php
+++ b/src/Symfony/Component/Workflow/Workflow.php
@@ -16,7 +16,7 @@
use Symfony\Component\Workflow\Event\GuardEvent;
use Symfony\Component\Workflow\Exception\LogicException;
use Symfony\Component\Workflow\MarkingStore\MarkingStoreInterface;
-use Symfony\Component\Workflow\MarkingStore\PropertyAccessorMarkingStore;
+use Symfony\Component\Workflow\MarkingStore\MultipleStateMarkingStore;
/**
* @author Fabien Potencier
@@ -33,7 +33,7 @@ class Workflow
public function __construct(Definition $definition, MarkingStoreInterface $markingStore = null, EventDispatcherInterface $dispatcher = null, $name = 'unnamed')
{
$this->definition = $definition;
- $this->markingStore = $markingStore ?: new PropertyAccessorMarkingStore();
+ $this->markingStore = $markingStore ?: new MultipleStateMarkingStore();
$this->dispatcher = $dispatcher;
$this->name = $name;
}