0

我正在尝试在 camunda 中使用 PHP SDK,但没有明确记录如何设置流程变量。

有任何想法吗?

4

1 回答 1

2

您可以使用ProcessInstanceService.

下面是演示发票收据的片段。

$camundaAPI = new \org\camunda\php\sdk\Api('http://localhost:8080/engine-rest');
$processDefinitionRequest = new \org\camunda\php\sdk\entity\request\ProcessDefinitionRequest();
$processDefinitions = $camundaAPI->processDefinition->getDefinitions($processDefinitionRequest);

foreach($processDefinitions AS $pd) {
    echo 'Process deployment id: ' . $pd->getDeploymentId() . "\n";
}

// Process instance (make the assumption that $pd is the desired object).
$procInstance = $camundaAPI->processDefinition->startInstanceByKey($pd->getKey(), $processDefinitionRequest);

// ProcessInstanceService
$procInstanceService = new \org\camunda\php\sdk\service\ProcessInstanceService('http://localhost:8080/engine-rest/');
$var = new \org\camunda\php\sdk\entity\request\VariableRequest();
$var->setType('String');
$var->setValue('H4CK4THON2014');
$procInstanceService->putProcessVariable($procInstance->getId(), 'creditor', $var);
于 2014-12-12T11:59:54.213 回答