Buenas,
En la acción update de un controlador concreto obtengo el siguiente error "NetworkError: 500 Internal Server Error - http://minimunight.local/index.php?r=ensal/update&id=3", lo más curioso es que lo hace todo de forma correcta (actualiza los datos en la base de datos) pero lo que hace es redireccionar. Os adjunto el código del controlador y la salida para debug a ver si me podeis ayudar, gracias.
Acción Update del controlador:
public function actionUpdate($id)
{
$model=$this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Ensal']))
{
$model->attributes=$_POST['Ensal'];
$model->fotoEnsal = CUploadedFile::getInstance($model, 'fotoEnsal');
if ($model->validate()) {
if($model->save()) {
print "Entro";
//$nombre = Yii::app()->params['dirEnsalImgs'].$model->id.'.'.substr($model->fotoEnsal->getName(),strrpos($model->fotoEnsal->getName(),'.')+1);
$nombre = Yii::app()->params['dirEnsalImgs'].$model->id.'.jpg';
$model->fotoEnsal->saveAs($nombre);
Yii::import('application.extensions.image.Image');
$foto = new Image($nombre);
$foto->resize(200, null);
$foto->save();
$this->redirect(array('view','id'=>$model->id));
}
}
}
$this->render('update',array(
'model'=>$model,
));
}
Ultima salida
09:03:49.917792 trace system.db.ar.CActiveRecord
Ensal.updateByPk()
in /var/www/protected/controllers/EnsalController.php (113)
in /var/www/index.php (16)
09:03:49.918003 trace system.db.CDbCommand
Executing SQL: UPDATE `ensal` SET `id`=:yp0, `nombre`=:yp1, `formula`=:yp2,
`id_zona`=:yp3, `cord_x`=:yp4, `cord_y`=:yp5, `longitud`=:yp6,
`nAcometidas`=:yp7, `nAbonados`=:yp8, `HInicioNoche`=:yp9,
`HFinNoche`=:yp10 WHERE `ensal`.`id`='3'
in /var/www/protected/controllers/EnsalController.php (113)
in /var/www/index.php (16)
La línea 113:
if($model->save()) {
Gracias a todos!!