/** * * @url GET /loadActionByEmail */ public function loadActionByEmail($params) { $criteria = new Criteria(); $criteria->addSelectColumn('COUNT(*)'); $criteria->addJoin(AbeConfigurationPeer::ABE_UID, AbeRequestsPeer::ABE_UID); $criteria->addJoin(AppDelegationPeer::APP_UID, AbeRequestsPeer::APP_UID); $criteria->addJoin(AppDelegationPeer::DEL_INDEX, AbeRequestsPeer::DEL_INDEX); $result = AbeConfigurationPeer::doSelectRS($criteria); $result->setFetchmode(ResultSet::FETCHMODE_ASSOC); $result->next(); $totalCount = $result->getRow(); $totalCount = $totalCount['COUNT(*)']; $criteria = new Criteria(); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID); $criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID); $criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_UPDATE_DATE); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_TEMPLATE); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD); $criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID); $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID); $criteria->addSelectColumn(AbeRequestsPeer::APP_UID); $criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX); $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SENT_TO); $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_STATUS); $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SUBJECT); $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED); $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY); $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_DATE); $criteria->addSelectColumn(ApplicationPeer::APP_NUMBER); $criteria->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS); $criteria->addJoin(AbeConfigurationPeer::ABE_UID, AbeRequestsPeer::ABE_UID); $criteria->addJoin(ApplicationPeer::APP_UID, AbeRequestsPeer::APP_UID); $criteria->addJoin(AppDelegationPeer::APP_UID, AbeRequestsPeer::APP_UID); $criteria->addJoin(AppDelegationPeer::DEL_INDEX, AbeRequestsPeer::DEL_INDEX); $criteria->addDescendingOrderByColumn(AbeRequestsPeer::ABE_REQ_DATE); $criteria->setLimit($_REQUEST['limit']); $criteria->setOffset($_REQUEST['start']); $result = AbeConfigurationPeer::doSelectRS($criteria); $result->setFetchmode(ResultSet::FETCHMODE_ASSOC); $data = Array(); $arrayPro = Array(); $arrayTAS = Array(); $index = 0; while ($result->next()) { $data[] = $result->getRow(); $criteriaRes = new Criteria(); $criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_UID); $criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_CLIENT_IP); $criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_DATA); $criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_STATUS); $criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_MESSAGE); $criteriaRes->add(AbeResponsesPeer::ABE_REQ_UID, $data[$index]['ABE_REQ_UID']); $resultRes = AbeResponsesPeer::doSelectRS($criteriaRes); $resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC); $resultRes->next(); $dataRes = Array(); if ($dataRes = $resultRes->getRow()) { $data[$index]['ABE_RES_UID'] = $dataRes['ABE_RES_UID']; $data[$index]['ABE_RES_CLIENT_IP'] = $dataRes['ABE_RES_CLIENT_IP']; $data[$index]['ABE_RES_DATA'] = $dataRes['ABE_RES_DATA']; $data[$index]['ABE_RES_STATUS'] = $dataRes['ABE_RES_STATUS']; $data[$index]['ABE_RES_MESSAGE'] = $dataRes['ABE_RES_MESSAGE']; } else { $data[$index]['ABE_RES_UID'] = ''; $data[$index]['ABE_RES_CLIENT_IP'] = ''; $data[$index]['ABE_RES_DATA'] = ''; $data[$index]['ABE_RES_STATUS'] = ''; $data[$index]['ABE_RES_MESSAGE'] = ''; } $criteriaRes = new Criteria(); $criteriaRes->addSelectColumn(AppDelegationPeer::USR_UID); $criteriaRes->addSelectColumn(UsersPeer::USR_FIRSTNAME); $criteriaRes->addSelectColumn(UsersPeer::USR_LASTNAME); $criteria->addJoin(AppDelegationPeer::APP_UID, $data[$index]['APP_UID']); $criteria->addJoin(AppDelegationPeer::DEL_INDEX, $data[$index]['DEL_PREVIOUS']); $criteria->addJoin(AppDelegationPeer::USR_UID, UsersPeer::USR_UID); $resultRes = AppDelegationPeer::doSelectRS($criteriaRes); $resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC); $resultRes->next(); if ($dataRes = $resultRes->getRow()) { $data[$index]['USER'] = $dataRes['USR_FIRSTNAME'] . ' ' . $dataRes['USR_LASTNAME']; } else { $data[$index]['USER'] = ''; } $data[$index]['ABE_REQ_ANSWERED'] = ($data[$index]['ABE_REQ_ANSWERED'] == 1) ? 'YES' : 'NO'; $index++; } $response = array(); $response['totalCount'] = $totalCount; $response['data'] = $data; return $response; }
/** * Method to do selects. * * @param Criteria $criteria The Criteria object used to build the SELECT statement. * @param Connection $con * @return array Array of selected Objects * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelect(Criteria $criteria, $con = null) { return AbeResponsesPeer::populateObjects(AbeResponsesPeer::doSelectRS($criteria, $con)); }