Que es lo que tengo mal??
Al intentar ver el registro me da error:
Controller:
class PruebaController extends Controller
{
public function actionIndex()
{
$pruebas=Prueba::model()->findAll();
$this->render('index',array('pruebas'=>$pruebas));
}
public function actionView(){
$model=Prueba::model()->findByPK($id);
$this->render('view',array('model'=>$model));
}
}
Model:
class Prueba extends CActiveRecord{
public static function model($className=__CLASS__)
{
return parent::model($className);
}
}
View de index:
<table width="200" border="1">
<?php foreach ($pruebas as $t){?>
<tr>
<td><strong><?php echo $t->id; ?></strong></td>
<td><strong><?php echo $t->nombre; ?></strong></td>
<td><?php echo $t->descripcion; ?></td>
<td><?php echo CHtml::link('ver',array('view','id'=>$t->id));?></td>
</tr>
<?php }?>
</table>
View:
<b> ID </b>
<?php echo $model->id.'<br>'; ?>
<b> Nombre </b>
<?php echo $model->nombre.'<br>'; ?>
<b> Descripcion </b>
<?php echo $model->descripcion.'<br>'; ?>
Yii me dice que tengo un erro ene sta linea:
$model=Prueba::model()->findByPK($id);
También debo añadir que soy nuevo en Yii, intento aprender pero no consigo encontrar el error. tengo instalado yii 1.1.10
Espero que me puedan ayudar,
Saludos.