/** * * @param PMSEObservable $subject * @return type */ public function update($subject) { if (method_exists($subject, 'getProcessDefinition')) { $this->logger->debug("Trigger update of a Related Relationship for a Process Definitions update"); $processDefinition = $subject->getProcessDefinition(); $processDefinitionData = $processDefinition->fetched_row; $fields = array('id', 'rel_element_type'); $relatedDependency = $this->getRelatedDependencyBean(); $this->sugarQuery->select($fields); $this->sugarQuery->from($relatedDependency); $this->sugarQuery->where()->queryAnd()->addRaw("pro_id='{$processDefinitionData['id']}' AND prj_id='{$processDefinitionData['prj_id']}' AND deleted=0"); $result = $this->sugarQuery->compileSql(); $this->logger->debug("Retrieve dependencies query: {$result}"); $rows = $this->sugarQuery->execute(); foreach ($rows as $row) { $bean = $this->getRelatedDependencyBean($row['id']); $bean->pro_status = $processDefinitionData['pro_status']; $bean->pro_locked_variables = $processDefinitionData['pro_locked_variables']; $bean->pro_terminate_variables = $processDefinitionData['pro_terminate_variables']; if ($bean->pro_module !== $processDefinitionData['pro_module'] && $row['rel_element_type'] == 'TERMINATE') { $bean->deleted = true; } $bean->save(); } $this->processRelatedDependencies($processDefinitionData); $depNumber = count($rows); $this->logger->debug("Updating {$depNumber} dependencies"); } return $result; }
/** * SQL query in the traditional from * * @param type $query * @param type $params * @return type */ public function raw_query($query, $params = null) { if (!empty($query)) { $this->prepared_query = $this->db->prepare($query); $this->prepared_query->execute($params); return $this->prepared_query; } elseif ($this->mode == 'dev') { throw new Exception('Empty query'); } else { die; } }
/** * 执行方法(其中还会继续调用另一execute),返回执行结果 * @param type $action * @return boolean */ private function execute($action) { $result = $action->execute($this->registry); //调用Action类中的execute方法 if (is_object($result)) { $action = $result; } elseif ($result === false) { $action = $this->error; $this->error = ''; } else { $action = false; } return $action; //实际就是$result 执行结果 }
/** * Method to validate whether a case been claimed * @param $casID * @param $casIndex * @return object */ public function validateReclaimCase($casID, $casIndex) { //TODO Review functionality $res = array(); //new stdClass(); $res['success'] = true; $res['result'] = false; //$caseBean = new BpmInbox(); $caseBean = $this->getInboxBean(); $this->sugarQueryObject->select(array('a.cas_id')); $this->sugarQueryObject->from($caseBean, array('alias' => 'a')); $this->sugarQueryObject->joinRaw("LEFT JOIN pmse_bpm_flow b ON (a.cas_id = b.cas_id)", array('alias' => 'b')); $this->sugarQueryObject->where()->queryAnd()->addRaw("b.cas_id = {$casID} and a.cas_index = {$casIndex}"); $rows = $this->sugarQueryObject->execute(); $caseData = $rows[0]; $res['message'] = translate('LBL_PMSE_LABEL_ERROR_INVALIDCLAIM', 'pmse_Project'); if ($caseData['cas_start_date'] == '') { $res['result'] = true; } return $res; }
/** * @brief 异步网络IO中断处理 * @param type $ahaAsyncIo * @return boolean */ protected function _ahaInterrupt($ahaAsyncIo) { if ($ahaAsyncIo instanceof \Aha\Client\Http || $ahaAsyncIo instanceof \Aha\Client\Tcp || $ahaAsyncIo instanceof \Aha\Client\Udp || $ahaAsyncIo instanceof \Aha\Client\Multi) { $ahaAsyncIo->loop(array($this, 'ahaClientCallback')); return true; } elseif ($ahaAsyncIo instanceof \Aha\Storage\Db\Coroutine || $ahaAsyncIo instanceof \Aha\Storage\Db\Transaction) { $ahaAsyncIo->execute(array($this, 'ahaDbCallback')); return true; } elseif ($ahaAsyncIo instanceof \Aha\Storage\Memory\Coroutine) { $ahaAsyncIo->execute(array($this, 'ahaRedisCallback')); return true; } return false; }
/** * */ public function setArrayRequest() { $this->_request = $this->_handleRequest->execute(); }
/** * Applique le pager à un template */ public function run(&$tpl) { global $pdo; $this->sql->execute(); $this->sqlCount->execute(); $total = $this->sqlCount->fetch(); $total = $total[0]; if ($this->start < 0 || $this->start > $total) { throw new Exception('Out of range'); } $hasPrev = $this->start - $this->nbByPage >= 0; $hasNext = $this->start + $this->nbByPage < $total; $table = array('total' => $total, 'prev' => urldup(array($this->key => $hasPrev ? $this->start - $this->nbByPage : 0)), 'next' => urldup(array($this->key => $hasNext ? $this->start + $this->nbByPage : $this->start)), 'showNext' => $hasNext, 'showPrev' => $hasPrev, 'rows' => array()); while ($line = $this->sql->fetch()) { $table['rows'][] = $line; } $tpl->assign($this->prepose . 'table', $table); }