public function GetNEmpateDoTime($id) { $pontos = 0; $model = new Confronto(); $Criteria = new CDbCriteria(); $Criteria->condition = "(id_time_casa = {$id} || id_time_visitante = {$id}) And empate = true"; $model = Confronto::model()->findAll($Criteria); foreach ($model as $ponto) { $pontos = $pontos + 1; } return $pontos; }
/** * 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 Confronto the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Confronto::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }