Monday, August 31, 2009

Problem with hasMany

I have a problem with a hasMany relationship. Locally everything works
fine, but when I upload files to the server I get the following error

Fatal error: Cannot access empty property in /sitiotmp/www2/nuevositio/
cake/libs/model/model.php on line 921

I'm using cake 1.2.3.8166

My models with de problem:

<?php
class Grupos_de_contenido extends AppModel{
var $name = 'Grupos_de_contenido';
var $primaryKey = 'id';
var $displayField = 'nombre';

var $hasMany = array('Contenido'=> array('className'=>'Contenido',

'foreignKey'=>'id_grupo_contenido',

'order'=>'Contenido.Prioridad DESC, Contenido.titulo ASC',

'conditions'=>'Contenido.publicado = true'
));
}
?>
---------
<?php
class Encuesta extends AppModel {
var $name = 'Encuesta';
var $tableName = 'encuestas';

var $hasMany = array('Respuesta'=>array
('className'=>'Respuesta', 'foreignKey'=>'id_encuesta'));

function obtenerEncuesta($id = null) {
$cond = array();
if(!is_null($id))
$cond = array('Encuesta.id' => $id);

return $this->find('first', array('contidions'=>$cond,
'order'=>'ORDER BY RAND()'));
}
}
?>

help?
Thanks!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: