Adding logic to remove related objects when a gateway is removed for BpmnWorkflow Adapter
- Now when a gateway is removed all its related flows are removed too - When a gateway is removed all Composed Workflow Routes are removed too
This commit is contained in:
@@ -3,7 +3,6 @@ namespace ProcessMaker\Project\Adapter;
|
||||
|
||||
use ProcessMaker\Project;
|
||||
use ProcessMaker\Util\Hash;
|
||||
use Symfony\Component\DependencyInjection\Exception\LogicException;
|
||||
|
||||
/**
|
||||
* Class BpmnWorkflow
|
||||
@@ -149,6 +148,32 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$this->wp->removeTask($actUid);
|
||||
}
|
||||
|
||||
public function removeGateway($gatUid)
|
||||
{
|
||||
$gatewayData = $this->getGateway($gatUid);
|
||||
$flowsDest = \BpmnFlow::findAllBy(\BpmnFlowPeer::FLO_ELEMENT_DEST, $gatUid);
|
||||
|
||||
foreach ($flowsDest as $flowDest) {
|
||||
switch ($flowDest->getFloElementOriginType()) {
|
||||
case "bpmnActivity":
|
||||
$actUid = $flowDest->getFloElementOrigin();
|
||||
$flowsOrigin = \BpmnFlow::findAllBy(\BpmnFlowPeer::FLO_ELEMENT_ORIGIN, $gatUid);
|
||||
|
||||
foreach ($flowsOrigin as $flowOrigin) {
|
||||
switch ($flowOrigin->getFloElementDestType()) {
|
||||
case "bpmnActivity":
|
||||
$toActUid = $flowOrigin->getFloElementDest();
|
||||
$this->wp->removeRouteFromTo($actUid, $toActUid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
parent::removeGateway($gatUid);
|
||||
}
|
||||
|
||||
// public function addFlow($data)
|
||||
// {
|
||||
// parent::addFlow($data);
|
||||
|
||||
Reference in New Issue
Block a user