/** * Implementation for 'DELETE' method for Rest API * * @param mixed $sesUid 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($sesUid) { $conn = Propel::getConnection(SessionPeer::DATABASE_NAME); try { $conn->begin(); $obj = SessionPeer::retrieveByPK($sesUid); 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()); } }
/** * Implementation for 'DELETE' method for Rest API * * @param mixed $sesUid 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($sesUid) { $conn = Propel::getConnection(SessionPeer::DATABASE_NAME); try { $conn->begin(); $obj = SessionPeer::retrieveByPK($sesUid); 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()); } }