BusinessProcess,Node: new helper methods

Mostly (but not only) useful for tests
This commit is contained in:
Thomas Gelf 2016-11-23 20:51:39 +01:00
parent 656a5ada0e
commit 4506181f0c
2 changed files with 36 additions and 0 deletions

View file

@ -468,6 +468,26 @@ class BusinessProcess
return $node;
}
/**
* Create and attach a new process (BpNode)
*
* @param string $name Process name
* @param string $operator Operator (defaults to &)
*
* @return BpNode
*/
public function createBp($name, $operator = '&')
{
$node = new BpNode($this, (object) array(
'name' => $name,
'operator' => $operator,
'child_names' => array(),
));
$this->addNode($name, $node);
return $node;
}
public function createImportedNode($config, $name)
{
$node = new ImportedNode($this, (object) array('name' => $name, 'configName' => $config));
@ -475,6 +495,11 @@ class BusinessProcess
return $node;
}
/**
* @param $name
* @return Node
* @throws Exception
*/
public function getNode($name)
{
if (array_key_exists($name, $this->nodes)) {

View file

@ -163,6 +163,17 @@ abstract class Node
return $this;
}
/**
* Forget my state
*
* @return $this
*/
public function clearState()
{
$this->state = null;
return $this;
}
public function setAck($ack = true)
{
$this->ack = $ack;