-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixes issue #13 with passing variables from and to sub-workflows #14
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,9 @@ | |
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
|
@@ -163,7 +163,14 @@ public function execute( ezcWorkflowExecution $execution ) | |
{ | ||
$subExecution = $execution->getSubExecution( $this->state ); | ||
$subExecution->workflow = $workflow; | ||
$subExecution->resume( $execution->getVariables() ); | ||
|
||
$subVariables = []; | ||
foreach ( $execution->getVariables() as $variableName => $data ) { | ||
if ( isset($this->configuration['variables']['in'][$variableName]) ) { | ||
$subVariables[$this->configuration['variables']['in'][$variableName]] = $data; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coding standards want the { on a new line on its own, please. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Overlooked that. Uncommon coding style for me. Will be fixed. |
||
} | ||
} | ||
$subExecution->resume( $subVariables ); | ||
} | ||
} | ||
|
||
|
@@ -188,9 +195,10 @@ public function execute( ezcWorkflowExecution $execution ) | |
} | ||
|
||
// Execution of Sub Workflow has been suspended. | ||
$reverseInVariableMap = array_flip( $this->configuration['variables']['in'] ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does this need to be flipped? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given an interactive sub-workflow node which maps |
||
foreach ( $subExecution->getWaitingFor() as $variableName => $data ) | ||
{ | ||
$execution->addWaitingFor( $this, $variableName, $data['condition'] ); | ||
$execution->addWaitingFor( $this, $reverseInVariableMap[$variableName], $data['condition'] ); | ||
} | ||
|
||
return false; | ||
|
@@ -298,7 +306,9 @@ protected function passVariables( ezcWorkflowExecution $from, ezcWorkflowExecuti | |
{ | ||
foreach ( $variables as $fromName => $toName ) | ||
{ | ||
$to->setVariable( $toName, $from->getVariable( $fromName ) ); | ||
if ( $from->hasVariable( $fromName ) ) { | ||
$to->setVariable( $toName, $from->getVariable( $fromName ) ); | ||
} | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please split white space changes out in a separate commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Sure.