/** * Retrieve object using using composite pkey values. * @param string $app_uid @param string $own_uid @param string $usr_uid * @param Connection $con * @return AppOwner */ public static function retrieveByPK($app_uid, $own_uid, $usr_uid, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $criteria = new Criteria(); $criteria->add(AppOwnerPeer::APP_UID, $app_uid); $criteria->add(AppOwnerPeer::OWN_UID, $own_uid); $criteria->add(AppOwnerPeer::USR_UID, $usr_uid); $v = AppOwnerPeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; }
/** * Implementation for 'DELETE' method for Rest API * * @param mixed $appUid, $ownUid, $usrUid 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($appUid, $ownUid, $usrUid) { $conn = Propel::getConnection(AppOwnerPeer::DATABASE_NAME); try { $conn->begin(); $obj = AppOwnerPeer::retrieveByPK($appUid, $ownUid, $usrUid); 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()); } }
public function removeCase($sAppUid) { try { $this->getExecuteTriggerProcess($sAppUid, 'DELETED'); $oAppDelegation = new AppDelegation(); $oAppDocument = new AppDocument(); //Delete the delegations of a application $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(AppDelegationPeer::APP_UID, $sAppUid); $oDataset2 = AppDelegationPeer::doSelectRS($oCriteria2); $oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset2->next(); while ($aRow2 = $oDataset2->getRow()) { $oAppDelegation->remove($sAppUid, $aRow2['DEL_INDEX']); $oDataset2->next(); } //Delete the documents assigned to a application $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(AppDocumentPeer::APP_UID, $sAppUid); $oDataset2 = AppDocumentPeer::doSelectRS($oCriteria2); $oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset2->next(); while ($aRow2 = $oDataset2->getRow()) { $oAppDocument->remove($aRow2['APP_DOC_UID'], $aRow2['DOC_VERSION']); $oDataset2->next(); } //Delete the actions from a application $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(AppDelayPeer::APP_UID, $sAppUid); AppDelayPeer::doDelete($oCriteria2); //Delete the messages from a application $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(AppMessagePeer::APP_UID, $sAppUid); AppMessagePeer::doDelete($oCriteria2); //Delete the threads from a application $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(AppThreadPeer::APP_UID, $sAppUid); AppThreadPeer::doDelete($oCriteria2); //Delete the events from a application $criteria = new Criteria("workflow"); $criteria->add(AppEventPeer::APP_UID, $sAppUid); AppEventPeer::doDelete($criteria); //Delete the histories from a application $criteria = new Criteria("workflow"); $criteria->add(AppHistoryPeer::APP_UID, $sAppUid); AppHistoryPeer::doDelete($criteria); //Delete the notes from a application $criteria = new Criteria("workflow"); $criteria->add(AppNotesPeer::APP_UID, $sAppUid); AppNotesPeer::doDelete($criteria); //Delete the owners from a application $criteria = new Criteria("workflow"); $criteria->add(AppOwnerPeer::APP_UID, $sAppUid); AppOwnerPeer::doDelete($criteria); //Delete the SolrQueue from a application $criteria = new Criteria("workflow"); $criteria->add(AppSolrQueuePeer::APP_UID, $sAppUid); AppSolrQueuePeer::doDelete($criteria); //Before delete verify if is a child case $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(SubApplicationPeer::APP_UID, $sAppUid); $oCriteria2->add(SubApplicationPeer::SA_STATUS, 'ACTIVE'); if (SubApplicationPeer::doCount($oCriteria2) > 0) { G::LoadClass('derivation'); $oDerivation = new Derivation(); $oDerivation->verifyIsCaseChild($sAppUid); } //Delete the registries in the table SUB_APPLICATION $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(SubApplicationPeer::APP_UID, $sAppUid); SubApplicationPeer::doDelete($oCriteria2); $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(SubApplicationPeer::APP_PARENT, $sAppUid); SubApplicationPeer::doDelete($oCriteria2); //Delete records of the table APP_ASSIGN_SELF_SERVICE_VALUE $appAssignSelfServiceValue = new AppAssignSelfServiceValue(); $appAssignSelfServiceValue->remove($sAppUid); //Delete records of the Report Table $this->reportTableDeleteRecord($sAppUid); //Delete record of the APPLICATION table (trigger: delete records of the APP_CACHE_VIEW table) $application = new Application(); $result = $application->remove($sAppUid); //delete application from index if ($this->appSolr != null) { $this->appSolr->deleteApplicationSearchIndex($sAppUid); } /*----------------------------------********---------------------------------*/ return $result; } catch (exception $e) { throw ($e); } }
/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = AppOwnerPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setAppUid($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setOwnUid($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setUsrUid($arr[$keys[2]]); } }