Skip to content

Commit

Permalink
change PHPMentorsWorkflowerExtension to use WorkflowContext inste…
Browse files Browse the repository at this point in the history
…ad of bare workflow ID
  • Loading branch information
iteman committed Mar 30, 2016
1 parent 55f08d2 commit 1f28445
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/DependencyInjection/PHPMentorsWorkflowerExtension.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (c) 2015 KUBO Atsuhiro <kubo@iteman.jp>,
* Copyright (c) 2015-2016 KUBO Atsuhiro <kubo@iteman.jp>,
* All rights reserved.
*
* This file is part of PHPMentorsWorkflowerBundle.
Expand Down Expand Up @@ -75,8 +75,13 @@ private function transformConfigToContainer(array $config, ContainerBuilder $con

$bpmn2WorkflowRepositoryDefinition->addMethodCall('add', array(new Reference($bpmn2FileServiceId)));

$workflowContextDefinition = new DefinitionDecorator('phpmentors_workflower.workflow_context');
$workflowContextDefinition->setArguments(array($workflowContextId, $workflowId));
$workflowContextServiceId = 'phpmentors_workflower.workflow_context.'.sha1($workflowContextId.$workflowId);
$container->setDefinition($workflowContextServiceId, $workflowContextDefinition);

$processDefinition = new DefinitionDecorator('phpmentors_workflower.process');
$processDefinition->setArguments(array(pathinfo($definitionFile->getFilename(), PATHINFO_FILENAME), new Reference($bpmn2WorkflowRepositoryServiceId)));
$processDefinition->setArguments(array(new Reference($workflowContextServiceId), new Reference($bpmn2WorkflowRepositoryServiceId)));
$processServiceId = 'phpmentors_workflower.process.'.sha1($workflowContextId.$workflowId);
$container->setDefinition($processServiceId, $processDefinition);
}
Expand Down
2 changes: 2 additions & 0 deletions src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<parameter key="phpmentors_workflower.process.class">PHPMentors\Workflower\Process\Process</parameter>
<parameter key="phpmentors_workflower.security_participant.class">PHPMentors\WorkflowerBundle\Workflow\Participant\SecurityParticipant</parameter>
<parameter key="phpmentors_workflower.work_item_context.class">PHPMentors\Workflower\Process\WorkItemContext</parameter>
<parameter key="phpmentors_workflower.workflow_context.class">PHPMentors\WorkflowerBundle\Process\WorkflowContext</parameter>
<!-- Configuration parameters -->
</parameters>
<services>
Expand All @@ -33,5 +34,6 @@
<service id="phpmentors_workflower.work_item_context" class="%phpmentors_workflower.work_item_context.class%" scope="prototype">
<argument type="service" id="phpmentors_workflower.participant"/>
</service>
<service id="phpmentors_workflower.workflow_context" class="%phpmentors_workflower.workflow_context.class%" public="false" abstract="true"/>
</services>
</container>

0 comments on commit 1f28445

Please sign in to comment.