and 'order'=>'ORDER BY RAND()'. I think that should be just
'order'=>'RAND()', but I could be wrong.
Looking at line 21 of 8166, there are 2 properties that it may be
failing on. I'd add these lines just above 921:
die(debug($this->alias));
die(debug($this->{$model}));
Run it once, then comment the 1st line. See if that shows anything helpful.
On Mon, Aug 31, 2009 at 4:18 PM, logislack<jhackes@gmail.com> wrote:
>
> 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:
Post a Comment