public function removeFlow($floUid) { $flow = \BpmnFlowPeer::retrieveByPK($floUid); parent::removeFlow($floUid); // verify case: event(start) -> activity // => find the corresponding task and unset it as start task if ($flow->getFloElementOriginType() == "bpmnEvent" && $flow->getFloElementDestType() == "bpmnActivity") { $bpmnFlow = \BpmnFlow::findOneBy(array(\BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $flow->getFloElementOrigin(), \BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => "bpmnEvent", \BpmnFlowPeer::FLO_ELEMENT_DEST => $flow->getFloElementDest(), \BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE => "bpmnActivity")); if (is_null($bpmnFlow)) { $event = \BpmnEventPeer::retrieveByPK($flow->getFloElementOrigin()); if (!is_null($event) && $event->getEvnType() == "START" && $event->getEvnMarker() == "EMPTY") { $activity = \BpmnActivityPeer::retrieveByPK($flow->getFloElementDest()); //Remove as start Task if (!is_null($activity)) { $this->wp->setStartTask($activity->getActUid(), false); } } } //$this->updateEventStartObjects($flow->getFloElementOrigin(), ""); //WebEntry-Event - Update if (is_null($bpmnFlow)) { $this->updateWebEntryEventByEvent($flow->getFloElementOrigin(), array("WEE_STATUS" => "DISABLED")); } } elseif ($flow->getFloElementOriginType() == "bpmnActivity" && $flow->getFloElementDestType() == "bpmnEvent") { // verify case: activity -> event(end) // => find the corresponding task and unset it as start task $event = \BpmnEventPeer::retrieveByPK($flow->getFloElementDest()); if (!is_null($event) && $event->getEvnType() == "END" && $event->getEvnMarker() == "EMPTY") { $activity = \BpmnActivityPeer::retrieveByPK($flow->getFloElementOrigin()); //Remove as end Task if (!is_null($activity)) { $this->wp->setEndTask($activity->getActUid(), false); } } } else { switch ($flow->getFloElementOriginType()) { case "bpmnActivity": switch ($flow->getFloElementDestType()) { //Activity1 -> Activity2 case "bpmnActivity": $this->wp->removeRouteFromTo($flow->getFloElementOrigin(), $flow->getFloElementDest()); break; } break; case "bpmnEvent": switch ($flow->getFloElementDestType()) { //Event1 -> Event2 case "bpmnEvent": if ($flow->getFloType() == "MESSAGE") { //Delete Message-Event-Relation $messageEventRelation = new \ProcessMaker\BusinessModel\MessageEventRelation(); $messageEventRelation->deleteWhere(array(\MessageEventRelationPeer::PRJ_UID => $flow->getPrjUid(), \MessageEventRelationPeer::EVN_UID_THROW => $flow->getFloElementOrigin(), \MessageEventRelationPeer::EVN_UID_CATCH => $flow->getFloElementDest())); } break; } break; } } // TODO Complete for other routes, activity->activity, activity->gateway and viceversa }