public function search() { $criteria = new CDbCriteria(); $criteria->compare('id', $this->id); $criteria->compare('payerLastName', $this->lastName, true); $criteria->compare('payerFirstName', $this->firstName, true); $criteria->compare('CONCAT(phoneOperatorCode, phoneNumber)', $this->phoneNumber, true); $criteria->order = 'id DESC'; $criteria->join = 'INNER JOIN {{payout_deposition}} pd ON pd.payoutTaskId = t.id'; $criteria->distinct = true; return new CActiveDataProvider(PayoutTask::model(), array('criteria' => $criteria)); }
/** * 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 Service the loaded model * @throws CHttpException */ public function loadModel($id) { $model = PayoutTask::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
protected function updateTaskStatus(PayoutTask $task) { $count = PayoutDeposition::model()->count("payoutTaskId = {$task->id} AND status = '" . PayoutDeposition::STATUS_REJECTED . '\''); if ($count > 0) { $task->status = PayoutTask::STATUS_FAILED; $task->save(); return $task; } $count = PayoutDeposition::model()->count("payoutTaskId = {$task->id} AND status = '" . PayoutDeposition::STATUS_IN_PROGRESS . '\''); if ($count > 0) { $task->status = PayoutTask::STATUS_IN_PROGRESS; $task->save(); return $task; } $count = PayoutDeposition::model()->count("payoutTaskId = {$task->id} AND status = '" . PayoutDeposition::STATUS_DONE . '\''); if ($count > 0) { $task->status = PayoutTask::STATUS_DONE; $task->save(); return $task; } }