コード例 #1
0
ファイル: Step.php プロジェクト: nshong/processmaker
 function reOrder($sStepUID, $iPosition)
 {
     try {
         /*$oCriteria1 = new Criteria('workflow');
           $oCriteria1->add(StepPeer::STEP_POSITION, StepPeer::STEP_POSITION);
           $oCriteria2 = new Criteria('workflow');
           $oCriteria2->add(StepPeer::TAS_UID,      $sTaskUID);
           $oCriteria2->add(StepPeer::STEP_POSITION, $iPosition, '>');
           BasePeer::doUpdate($oCriteria2, $oCriteria1, Propel::getConnection('workflow'));*/
         $oStep = StepPeer::retrieveByPK($sStepUID);
         $sTaskUID = $oStep->getTasUid();
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(StepPeer::TAS_UID, $sTaskUID);
         $oCriteria->add(StepPeer::STEP_POSITION, $iPosition, '>');
         $oDataset = StepPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oStep = StepPeer::retrieveByPK($aRow['STEP_UID']);
             $oStep->setStepPosition($aRow['STEP_POSITION'] - 1);
             $oStep->save();
             $oDataset->next();
         }
     } catch (Exception $oException) {
         throw $oException;
     }
 }
コード例 #2
0
ファイル: Step.php プロジェクト: rodrigoivan/processmaker
 /**
  * Implementation for 'DELETE' method for Rest API
  *
  * @param  mixed $stepUid Primary key
  *
  * @return array $result Returns array within multiple records or a single record depending if
  *                       a single selection was requested passing id(s) as param
  */
 protected function delete($stepUid)
 {
     $conn = Propel::getConnection(StepPeer::DATABASE_NAME);
     try {
         $conn->begin();
         $obj = StepPeer::retrieveByPK($stepUid);
         if (!is_object($obj)) {
             throw new RestException(412, 'Record does not exist.');
         }
         $obj->delete();
         $conn->commit();
     } catch (Exception $e) {
         $conn->rollback();
         throw new RestException(412, $e->getMessage());
     }
 }
コード例 #3
0
ファイル: Step.php プロジェクト: emildev35/processmaker
 /**
  * Implementation for 'DELETE' method for Rest API
  *
  * @param  mixed $stepUid Primary key
  *
  * @return array $result Returns array within multiple records or a single record depending if
  *                       a single selection was requested passing id(s) as param
  */
 protected function delete($stepUid)
 {
     $conn = Propel::getConnection(StepPeer::DATABASE_NAME);
     try {
         $conn->begin();
         $obj = StepPeer::retrieveByPK($stepUid);
         if (!is_object($obj)) {
             throw new RestException(412, G::LoadTranslation('ID_RECORD_DOES_NOT_EXIST'));
         }
         $obj->delete();
         $conn->commit();
     } catch (Exception $e) {
         $conn->rollback();
         throw new RestException(412, $e->getMessage());
     }
 }