コード例 #1
0
ファイル: BpmnWorkflow.php プロジェクト: rrsc/processmaker
    public function removeElementTaskRelation($elementUid, $elementType)
    {
        try {
            $elementTaskRelation = new \ProcessMaker\BusinessModel\ElementTaskRelation();

            $arrayElementTaskRelationData = $elementTaskRelation->getElementTaskRelationWhere(
                array(
                    \ElementTaskRelationPeer::PRJ_UID      => $this->wp->getUid(),
                    \ElementTaskRelationPeer::ELEMENT_UID  => $elementUid,
                    \ElementTaskRelationPeer::ELEMENT_TYPE => $elementType
                ),
                true
            );

            if (!is_null($arrayElementTaskRelationData)) {
                //Task - Delete
                $arrayTaskData = $this->wp->getTask($arrayElementTaskRelationData["TAS_UID"]);

                if (!is_null($arrayTaskData)) {
                    $this->wp->removeTask($arrayElementTaskRelationData["TAS_UID"]);
                }

                //Element-Task-Relation - Delete
                $elementTaskRelation->deleteWhere(array(\ElementTaskRelationPeer::ETR_UID => $arrayElementTaskRelationData["ETR_UID"]));

                //Array - Delete element
                unset($this->arrayElementTaskRelation[$elementUid]);
            }
        } catch (\Exception $e) {
            throw $e;
        }
    }