/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return WhiteListedMobile the loaded model * @throws CHttpException */ public function loadModel($id) { $model = WhiteListedMobile::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public static function getCleanMobileNumberIncDups($queue_id) { $queue_id = intval($queue_id); $criteriaWhiteList = new CDbCriteria(); $criteriaWhiteList->compare("queue_id", $queue_id); $totalWhiteListed = WhiteListedMobile::model()->count($criteriaWhiteList); $totalWhiteListed = intval($totalWhiteListed); /*get total white list using queue id*/ $offset = 0; $limit = 1000000; do { $sqlQuery = ' select a.mobile_number from white_listed_mobile as a left join black_listed_mobile as b on a.mobile_number = b.mobile_number where a.queue_id = ' . $queue_id . ' and b.mobile_number IS NULL LIMIT ' . $limit . ' OFFSET ' . $offset . ' '; $allResults = Yii::app()->db->createCommand($sqlQuery)->queryAll(); foreach ($allResults as $curVal) { echo $curVal['mobile_number'] . "\r\n"; } $offset += $limit; } while ($offset < $totalWhiteListed); }