/**
  * Implementation for 'GET' method for Rest API
  *
  * @param  mixed $puUid 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 get($puUid = null)
 {
     $result = array();
     try {
         $noArguments = true;
         $argumentList = func_get_args();
         foreach ($argumentList as $arg) {
             if (!is_null($arg)) {
                 $noArguments = false;
             }
         }
         if ($noArguments) {
             $criteria = new Criteria('workflow');
             $criteria->addSelectColumn(ProcessUserPeer::PU_UID);
             $criteria->addSelectColumn(ProcessUserPeer::PRO_UID);
             $criteria->addSelectColumn(ProcessUserPeer::USR_UID);
             $criteria->addSelectColumn(ProcessUserPeer::PU_TYPE);
             $dataset = AppEventPeer::doSelectRS($criteria);
             $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
             while ($dataset->next()) {
                 $result[] = $dataset->getRow();
             }
         } else {
             $record = ProcessUserPeer::retrieveByPK($puUid);
             if ($record) {
                 $result = $record->toArray(BasePeer::TYPE_FIELDNAME);
             } else {
                 $paramValues = "";
                 foreach ($argumentList as $arg) {
                     $paramValues .= strlen($paramValues) ? ', ' : '';
                     if (!is_null($arg)) {
                         $paramValues .= "{$arg}";
                     } else {
                         $paramValues .= "NULL";
                     }
                 }
                 throw new RestException(417, "table ProcessUser ({$paramValues})");
             }
         }
     } catch (RestException $e) {
         throw new RestException($e->getCode(), $e->getMessage());
     } catch (Exception $e) {
         throw new RestException(412, $e->getMessage());
     }
     return $result;
 }
Exemple #2
0
 /**
  * Remove the application document registry
  * @param string $sPuUid
  * @param string $sProUid
  * @param string $sUserUid
  * @return string
  **/
 public function remove($sPuUid)
 {
     $oConnection = Propel::getConnection(ProcessUserPeer::DATABASE_NAME);
     try {
         $oProcessUser = ProcessUserPeer::retrieveByPK($sPuUid);
         if (!is_null($oProcessUser)) {
             $oConnection->begin();
             $iResult = $oProcessUser->delete();
             $oConnection->commit();
             return $iResult;
         } else {
             throw new Exception('This row doesn\'t exist!');
         }
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw $oError;
     }
 }
 /**
  * Remove a supervisor
  *
  * @param string $sProcessUID
  * @param string $sPuUID
  * @access public
  */
 public function removeProcessSupervisor($sProcessUID, $sPuUID)
 {
     $oConnection = \Propel::getConnection(\ProcessUserPeer::DATABASE_NAME);
     try {
         $oProcessUser = \ProcessUserPeer::retrieveByPK($sPuUID);
         if (!is_null($oProcessUser)) {
             $oConnection->begin();
             $iResult = $oProcessUser->delete();
             $oConnection->commit();
             return $iResult;
         } else {
             throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST"));
         }
     } catch (\Exception $e) {
         $oConnection->rollback();
         throw $e;
     }
 }