From 2ca6f283c9ccb678e543e61f14da2efcde43901b Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:11:15 +0100 Subject: [PATCH 01/20] Create MarkingHistoryStore.php --- .../Workflow/MarkingHistoryStore.php | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 src/Symfony/Component/Workflow/MarkingHistoryStore.php diff --git a/src/Symfony/Component/Workflow/MarkingHistoryStore.php b/src/Symfony/Component/Workflow/MarkingHistoryStore.php new file mode 100644 index 0000000000000..dea8ce5e69f43 --- /dev/null +++ b/src/Symfony/Component/Workflow/MarkingHistoryStore.php @@ -0,0 +1,75 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Workflow; + +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Component\PropertyAccess\PropertyAccess; + +/** + * + */ +final class MarkingHistoryStore +{ + private $historyProperty; + private $memoProperty; + + private $historyPropertyAccessor; + private $memoPropertyAccessor; + + public function __construct(string $historyProperty, string $memoProperty = null, PropertyAccessorInterface $historyPropertyAccessor = null, PropertyAccessorInterface $memoPropertyAccessor = null) + { + $this->historyProperty = $historyProperty; + $this->memoProperty = $memoProperty; + + $this->historyPropertyAccessor = $historyPropertyAccessor ?? PropertyAccess::createPropertyAccessor();; + $this->memoPropertyAccessor = $memoPropertyAccessor ?? PropertyAccess::createPropertyAccessor(); + } + + /** + * @param $subject + * @param $transition Transition + * @param $marking string + * @param $workflowName string + */ + public function updateMarkingHistory($subject, Transition $transition, Marking $marking, $workflowName) + { + // get existing state history for this object + $existingHistory = $this->historyPropertyAccessor->getValue($subject, $this->historyProperty) ?? []; + + + // build the array to append to the log, using the workflow name as the log's key + $arr = []; + $dt = new \DateTime(); + $arr['timestamp'] = $dt->format('Y-m-d H:i:s'); + $arr['marking'] = $marking->getPlaces(); + $arr['transition'] = $transition->getName(); + + if ($this->memoProperty !== null) + { + $arr['memo'] = $this->memoPropertyAccessor->getValue($subject, $this->memoProperty) ?? ''; // an optional memo + } + + // the key is used to allow logging the history of multiple workflows + $key = $workflowName; + if (!array_key_exists($key, $existingHistory)) { + $existingHistory[$key] = []; + } + $existingHistory[$key][] = $arr; + + // set the history property value + $this->historyPropertyAccessor->setValue($subject, $this->historyProperty, $existingHistory); + + // finally, clear out the memo field now that it's been logged + $this->memoPropertyAccessor->setValue($subject, $this->memoProperty, null); + } + +} From 040d99d826a3b91e6541c6fb686218d35f5438aa Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:14:34 +0100 Subject: [PATCH 02/20] Update WorkflowInterface.php --- src/Symfony/Component/Workflow/WorkflowInterface.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Symfony/Component/Workflow/WorkflowInterface.php b/src/Symfony/Component/Workflow/WorkflowInterface.php index 5a1f2c74e81aa..36949f7ce7c5a 100644 --- a/src/Symfony/Component/Workflow/WorkflowInterface.php +++ b/src/Symfony/Component/Workflow/WorkflowInterface.php @@ -85,4 +85,10 @@ public function getDefinition(); public function getMarkingStore(); public function getMetadataStore(): MetadataStoreInterface; + + /** + * Returns the optional Marking History Store for logging the state history on the entity + * @return null|MarkingHistoryStore + */ + public function getMarkingHistoryStore() : ?MarkingHistoryStore; } From cb57ff8f22a21beec465227d71f78e3e8461908f Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:16:22 +0100 Subject: [PATCH 03/20] Update Workflow.php --- src/Symfony/Component/Workflow/Workflow.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Workflow/Workflow.php b/src/Symfony/Component/Workflow/Workflow.php index 963f1b8b27180..d367007ef199b 100644 --- a/src/Symfony/Component/Workflow/Workflow.php +++ b/src/Symfony/Component/Workflow/Workflow.php @@ -32,13 +32,15 @@ class Workflow implements WorkflowInterface private $markingStore; private $dispatcher; private $name; + private $markingHistoryStore; - public function __construct(Definition $definition, MarkingStoreInterface $markingStore = null, EventDispatcherInterface $dispatcher = null, string $name = 'unnamed') + public function __construct(Definition $definition, MarkingStoreInterface $markingStore = null, EventDispatcherInterface $dispatcher = null, string $name = 'unnamed', MarkingHistoryStore $markingHistoryStore = null) { $this->definition = $definition; $this->markingStore = $markingStore ?: new MultipleStateMarkingStore(); $this->dispatcher = $dispatcher; $this->name = $name; + $this->markingHistoryStore = $markingHistoryStore; } /** @@ -159,6 +161,11 @@ public function apply($subject, $transitionName) $this->enter($subject, $transition, $marking); $this->markingStore->setMarking($subject, $marking); + + if ($this->markingHistoryStore !== null) + { + $this->markingHistoryStore->updateMarkingHistory($subject, $transition, $marking, $this->getName()); + } $this->entered($subject, $transition, $marking); @@ -363,4 +370,9 @@ private function announce($subject, Transition $initialTransition, Marking $mark $this->dispatcher->dispatch(sprintf('workflow.%s.announce.%s', $this->name, $transition->getName()), $event); } } + + public function getMarkingHistoryStore() : ?MarkingHistoryStore + { + return $this->markingHistoryStore; + } } From 04511dd5e1184513b7c6827191942f23403aa443 Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:16:46 +0100 Subject: [PATCH 04/20] Update StateMachine.php --- src/Symfony/Component/Workflow/StateMachine.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Workflow/StateMachine.php b/src/Symfony/Component/Workflow/StateMachine.php index 6adf1f4dcbddb..b4afcd5b041a2 100644 --- a/src/Symfony/Component/Workflow/StateMachine.php +++ b/src/Symfony/Component/Workflow/StateMachine.php @@ -11,8 +11,8 @@ */ class StateMachine extends Workflow { - public function __construct(Definition $definition, MarkingStoreInterface $markingStore = null, EventDispatcherInterface $dispatcher = null, string $name = 'unnamed') + public function __construct(Definition $definition, MarkingStoreInterface $markingStore = null, EventDispatcherInterface $dispatcher = null, string $name = 'unnamed', MarkingHistoryStore $markingHistoryStore = null) { - parent::__construct($definition, $markingStore ?: new SingleStateMarkingStore(), $dispatcher, $name); + parent::__construct($definition, $markingStore ?: new SingleStateMarkingStore(), $dispatcher, $name, $markingHistoryStore); } } From 531ae8e945ccdbd6a19d8d581eaee4646358417d Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:18:18 +0100 Subject: [PATCH 05/20] Update workflow.xml --- .../Bundle/FrameworkBundle/Resources/config/workflow.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml index d881f699f75ec..e0a2060c3babf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml @@ -12,17 +12,21 @@ null + null null + null + + From 44b3eda04e3ec581c3f50062371ab426792cfa93 Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:19:24 +0100 Subject: [PATCH 06/20] Update Configuration.php --- .../FrameworkBundle/DependencyInjection/Configuration.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 1766366252147..27ef7913e2c1f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -244,6 +244,12 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode) ->arrayNode('audit_trail') ->canBeEnabled() ->end() + ->arrayNode('marking_history_store') + ->children() + ->scalarNode('history_property')->isRequired()->end() + ->scalarNode('memo_property')->end() + ->end() + ->end() ->enumNode('type') ->values(array('workflow', 'state_machine')) ->defaultValue('state_machine') From ff7c41a31c389cc459d41576cdfa47c77696d64f Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:21:44 +0100 Subject: [PATCH 07/20] Update FrameworkExtension.php --- .../DependencyInjection/FrameworkExtension.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 1321d7126c899..27d9f61480f4c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -572,6 +572,18 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $ $markingStoreDefinition = new Reference($workflow['marking_store']['service']); } + // create Marking History Store for optionally logging state history + if (isset($workflow['marking_history_store'])) + { + $historyProperty = $workflow['marking_history_store']['history_property']; + $memoProperty = $workflow['marking_history_store']['memo_property']; + + $markingHistoryDefinition = new Definition(Workflow\MarkingHistoryStore::class); + $markingHistoryDefinition->setPublic(false); + $markingHistoryDefinition->addArgument($historyProperty); + $markingHistoryDefinition->addArgument($memoProperty); + } + // Create Workflow $workflowId = sprintf('%s.%s', $type, $name); $workflowDefinition = new ChildDefinition(sprintf('%s.abstract', $type)); @@ -580,6 +592,9 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $ $workflowDefinition->replaceArgument(1, $markingStoreDefinition); } $workflowDefinition->replaceArgument(3, $name); + if (isset($markingHistoryDefinition)) { + $workflowDefinition->replaceArgument(4, $markingHistoryDefinition); + } // Store to container $container->setDefinition($workflowId, $workflowDefinition); From e43d9ea1a9f520a9c494f9ca2a2ebc631b1f5258 Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:37:39 +0100 Subject: [PATCH 08/20] Update StateMachine.php --- src/Symfony/Component/Workflow/StateMachine.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Symfony/Component/Workflow/StateMachine.php b/src/Symfony/Component/Workflow/StateMachine.php index b4afcd5b041a2..a8ac3bb353e7f 100644 --- a/src/Symfony/Component/Workflow/StateMachine.php +++ b/src/Symfony/Component/Workflow/StateMachine.php @@ -1,5 +1,15 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Component\Workflow; use Symfony\Component\EventDispatcher\EventDispatcherInterface; From 6e04a73dfc1e82dfe1bc55f6d45ad0fab3f705fc Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:39:28 +0100 Subject: [PATCH 09/20] Update FrameworkExtension.php --- .../DependencyInjection/FrameworkExtension.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 27d9f61480f4c..a488e88d0b66a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -573,8 +573,7 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $ } // create Marking History Store for optionally logging state history - if (isset($workflow['marking_history_store'])) - { + if (isset($workflow['marking_history_store'])) { $historyProperty = $workflow['marking_history_store']['history_property']; $memoProperty = $workflow['marking_history_store']['memo_property']; @@ -583,7 +582,7 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $ $markingHistoryDefinition->addArgument($historyProperty); $markingHistoryDefinition->addArgument($memoProperty); } - + // Create Workflow $workflowId = sprintf('%s.%s', $type, $name); $workflowDefinition = new ChildDefinition(sprintf('%s.abstract', $type)); From 88cce38aabc064ad491d73f3dd610c86c2563259 Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:40:06 +0100 Subject: [PATCH 10/20] Update MarkingHistoryStore.php --- src/Symfony/Component/Workflow/MarkingHistoryStore.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Workflow/MarkingHistoryStore.php b/src/Symfony/Component/Workflow/MarkingHistoryStore.php index dea8ce5e69f43..8c536206f7c17 100644 --- a/src/Symfony/Component/Workflow/MarkingHistoryStore.php +++ b/src/Symfony/Component/Workflow/MarkingHistoryStore.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Workflow; -use Symfony\Component\PropertyAccess\PropertyAccessorInterface; use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; /** * From 2771f3d2695d3420d8f0655b3bca9c98b60eb81a Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:41:31 +0100 Subject: [PATCH 11/20] Update MarkingHistoryStore.php --- .../Component/Workflow/MarkingHistoryStore.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Workflow/MarkingHistoryStore.php b/src/Symfony/Component/Workflow/MarkingHistoryStore.php index 8c536206f7c17..4b8614af4ee0e 100644 --- a/src/Symfony/Component/Workflow/MarkingHistoryStore.php +++ b/src/Symfony/Component/Workflow/MarkingHistoryStore.php @@ -14,9 +14,6 @@ use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\PropertyAccess\PropertyAccessorInterface; -/** - * - */ final class MarkingHistoryStore { private $historyProperty; @@ -30,7 +27,7 @@ public function __construct(string $historyProperty, string $memoProperty = null $this->historyProperty = $historyProperty; $this->memoProperty = $memoProperty; - $this->historyPropertyAccessor = $historyPropertyAccessor ?? PropertyAccess::createPropertyAccessor();; + $this->historyPropertyAccessor = $historyPropertyAccessor ?? PropertyAccess::createPropertyAccessor(); $this->memoPropertyAccessor = $memoPropertyAccessor ?? PropertyAccess::createPropertyAccessor(); } @@ -47,21 +44,20 @@ public function updateMarkingHistory($subject, Transition $transition, Marking $ // build the array to append to the log, using the workflow name as the log's key - $arr = []; + $arr = array(); $dt = new \DateTime(); $arr['timestamp'] = $dt->format('Y-m-d H:i:s'); $arr['marking'] = $marking->getPlaces(); $arr['transition'] = $transition->getName(); - if ($this->memoProperty !== null) - { + if ($this->memoProperty !== null) { $arr['memo'] = $this->memoPropertyAccessor->getValue($subject, $this->memoProperty) ?? ''; // an optional memo } // the key is used to allow logging the history of multiple workflows $key = $workflowName; if (!array_key_exists($key, $existingHistory)) { - $existingHistory[$key] = []; + $existingHistory[$key] = array(); } $existingHistory[$key][] = $arr; @@ -71,5 +67,4 @@ public function updateMarkingHistory($subject, Transition $transition, Marking $ // finally, clear out the memo field now that it's been logged $this->memoPropertyAccessor->setValue($subject, $this->memoProperty, null); } - } From cf4b7f8a8bbbea300e6c289841c54dbc32e16797 Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:42:22 +0100 Subject: [PATCH 12/20] Update Workflow.php --- src/Symfony/Component/Workflow/Workflow.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Workflow/Workflow.php b/src/Symfony/Component/Workflow/Workflow.php index d367007ef199b..3dd4b973c09c5 100644 --- a/src/Symfony/Component/Workflow/Workflow.php +++ b/src/Symfony/Component/Workflow/Workflow.php @@ -162,8 +162,7 @@ public function apply($subject, $transitionName) $this->markingStore->setMarking($subject, $marking); - if ($this->markingHistoryStore !== null) - { + if ($this->markingHistoryStore !== null) { $this->markingHistoryStore->updateMarkingHistory($subject, $transition, $marking, $this->getName()); } @@ -371,7 +370,7 @@ private function announce($subject, Transition $initialTransition, Marking $mark } } - public function getMarkingHistoryStore() : ?MarkingHistoryStore + public function getMarkingHistoryStore(): ?MarkingHistoryStore { return $this->markingHistoryStore; } From b0e33110e2a331d79a876cc3446a575df00ad53b Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:43:54 +0100 Subject: [PATCH 13/20] Update WorkflowInterface.php --- src/Symfony/Component/Workflow/WorkflowInterface.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Workflow/WorkflowInterface.php b/src/Symfony/Component/Workflow/WorkflowInterface.php index 36949f7ce7c5a..a38379bb3f4be 100644 --- a/src/Symfony/Component/Workflow/WorkflowInterface.php +++ b/src/Symfony/Component/Workflow/WorkflowInterface.php @@ -85,10 +85,11 @@ public function getDefinition(); public function getMarkingStore(); public function getMetadataStore(): MetadataStoreInterface; - + /** - * Returns the optional Marking History Store for logging the state history on the entity + * Returns the optional Marking History Store for logging the state history on the entity. + * * @return null|MarkingHistoryStore */ - public function getMarkingHistoryStore() : ?MarkingHistoryStore; + public function getMarkingHistoryStore(): ?MarkingHistoryStore; } From 53d6252bd89e77edd814769c0efd700b22c3f156 Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:45:34 +0100 Subject: [PATCH 14/20] Update StateMachine.php --- src/Symfony/Component/Workflow/StateMachine.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Symfony/Component/Workflow/StateMachine.php b/src/Symfony/Component/Workflow/StateMachine.php index a8ac3bb353e7f..7d5e7dfd56d99 100644 --- a/src/Symfony/Component/Workflow/StateMachine.php +++ b/src/Symfony/Component/Workflow/StateMachine.php @@ -1,7 +1,6 @@ From 0f4fd34a242724d9d716e41e55b2703baabc515f Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:47:25 +0100 Subject: [PATCH 15/20] Update MarkingHistoryStore.php --- src/Symfony/Component/Workflow/MarkingHistoryStore.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Workflow/MarkingHistoryStore.php b/src/Symfony/Component/Workflow/MarkingHistoryStore.php index 4b8614af4ee0e..12a9466122953 100644 --- a/src/Symfony/Component/Workflow/MarkingHistoryStore.php +++ b/src/Symfony/Component/Workflow/MarkingHistoryStore.php @@ -40,7 +40,7 @@ public function __construct(string $historyProperty, string $memoProperty = null public function updateMarkingHistory($subject, Transition $transition, Marking $marking, $workflowName) { // get existing state history for this object - $existingHistory = $this->historyPropertyAccessor->getValue($subject, $this->historyProperty) ?? []; + $existingHistory = $this->historyPropertyAccessor->getValue($subject, $this->historyProperty) ?? array(); // build the array to append to the log, using the workflow name as the log's key @@ -50,7 +50,7 @@ public function updateMarkingHistory($subject, Transition $transition, Marking $ $arr['marking'] = $marking->getPlaces(); $arr['transition'] = $transition->getName(); - if ($this->memoProperty !== null) { + if (null !== $this->memoProperty) { $arr['memo'] = $this->memoPropertyAccessor->getValue($subject, $this->memoProperty) ?? ''; // an optional memo } From 3389f07a3eefe7163961acf939752c5c95fb5f34 Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:49:00 +0100 Subject: [PATCH 16/20] Update Workflow.php --- src/Symfony/Component/Workflow/Workflow.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Workflow/Workflow.php b/src/Symfony/Component/Workflow/Workflow.php index 3dd4b973c09c5..bcfbca1e7b242 100644 --- a/src/Symfony/Component/Workflow/Workflow.php +++ b/src/Symfony/Component/Workflow/Workflow.php @@ -161,8 +161,8 @@ public function apply($subject, $transitionName) $this->enter($subject, $transition, $marking); $this->markingStore->setMarking($subject, $marking); - - if ($this->markingHistoryStore !== null) { + + if (null !== $this->markingHistoryStore) { $this->markingHistoryStore->updateMarkingHistory($subject, $transition, $marking, $this->getName()); } @@ -369,7 +369,7 @@ private function announce($subject, Transition $initialTransition, Marking $mark $this->dispatcher->dispatch(sprintf('workflow.%s.announce.%s', $this->name, $transition->getName()), $event); } } - + public function getMarkingHistoryStore(): ?MarkingHistoryStore { return $this->markingHistoryStore; From 7e4f412bb32d2a4a653e850841966b41148c2c05 Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:49:56 +0100 Subject: [PATCH 17/20] Update MarkingHistoryStore.php --- src/Symfony/Component/Workflow/MarkingHistoryStore.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Symfony/Component/Workflow/MarkingHistoryStore.php b/src/Symfony/Component/Workflow/MarkingHistoryStore.php index 12a9466122953..89101dcf1e804 100644 --- a/src/Symfony/Component/Workflow/MarkingHistoryStore.php +++ b/src/Symfony/Component/Workflow/MarkingHistoryStore.php @@ -42,7 +42,6 @@ public function updateMarkingHistory($subject, Transition $transition, Marking $ // get existing state history for this object $existingHistory = $this->historyPropertyAccessor->getValue($subject, $this->historyProperty) ?? array(); - // build the array to append to the log, using the workflow name as the log's key $arr = array(); $dt = new \DateTime(); From 0050ca93ff5fd48198471904e043981b67c102d2 Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:52:58 +0100 Subject: [PATCH 18/20] Update MarkingHistoryStore.php --- src/Symfony/Component/Workflow/MarkingHistoryStore.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Workflow/MarkingHistoryStore.php b/src/Symfony/Component/Workflow/MarkingHistoryStore.php index 89101dcf1e804..09370f225ed0a 100644 --- a/src/Symfony/Component/Workflow/MarkingHistoryStore.php +++ b/src/Symfony/Component/Workflow/MarkingHistoryStore.php @@ -34,7 +34,7 @@ public function __construct(string $historyProperty, string $memoProperty = null /** * @param $subject * @param $transition Transition - * @param $marking string + * @param $marking Marking * @param $workflowName string */ public function updateMarkingHistory($subject, Transition $transition, Marking $marking, $workflowName) From 226d928451a68008f9d5ba107a9a16b272eccee0 Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sat, 25 Aug 2018 23:54:09 +0100 Subject: [PATCH 19/20] Update MarkingHistoryStore.php --- src/Symfony/Component/Workflow/MarkingHistoryStore.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Workflow/MarkingHistoryStore.php b/src/Symfony/Component/Workflow/MarkingHistoryStore.php index 09370f225ed0a..2d737a25eb95e 100644 --- a/src/Symfony/Component/Workflow/MarkingHistoryStore.php +++ b/src/Symfony/Component/Workflow/MarkingHistoryStore.php @@ -37,7 +37,7 @@ public function __construct(string $historyProperty, string $memoProperty = null * @param $marking Marking * @param $workflowName string */ - public function updateMarkingHistory($subject, Transition $transition, Marking $marking, $workflowName) + public function updateMarkingHistory($subject, Transition $transition, Marking $marking, string $workflowName) { // get existing state history for this object $existingHistory = $this->historyPropertyAccessor->getValue($subject, $this->historyProperty) ?? array(); From a136b818e9ed77e820b920b9d2ca785c68dbef7e Mon Sep 17 00:00:00 2001 From: ChangePlaces Date: Sun, 26 Aug 2018 01:24:09 +0100 Subject: [PATCH 20/20] Update MarkingHistoryStore.php --- src/Symfony/Component/Workflow/MarkingHistoryStore.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Symfony/Component/Workflow/MarkingHistoryStore.php b/src/Symfony/Component/Workflow/MarkingHistoryStore.php index 2d737a25eb95e..a638fafb6fde7 100644 --- a/src/Symfony/Component/Workflow/MarkingHistoryStore.php +++ b/src/Symfony/Component/Workflow/MarkingHistoryStore.php @@ -44,8 +44,7 @@ public function updateMarkingHistory($subject, Transition $transition, Marking $ // build the array to append to the log, using the workflow name as the log's key $arr = array(); - $dt = new \DateTime(); - $arr['timestamp'] = $dt->format('Y-m-d H:i:s'); + $arr['timestamp'] = date('Y-m-d H:i:s'); $arr['marking'] = $marking->getPlaces(); $arr['transition'] = $transition->getName();