hi brian, thanks for reply

I made the changes you mentioned in the models and now the error is
the same but in another line:
Fatal error: Can not access empty property in / sitiotmp/www2/
nuevositio/cake/libs/model/model.php on line 948

I added lines before the 948 and got the "DUMP 1"

After this i add these lines:
                if(!isset($this->alias) || empty($this->alias))
                        { die('Es $this->alias'); }
                if(!isset($model) || empty($model))
                        { die('Is $this->{$model} = "'. $model . '" on ' . 
$this->alias); }


I got this response:

Is $this->{$model} = "" on Contenido


see something important?
thanks again.



/*********************************************************/
DUMP 1
/**************die(debug($this->alias)); ******************/

Grupos_de_contenido

 /****************die(debug($this->{$model}));****************/

Contenido Object
(
    [name] => Contenido
    [primaryKey] => id
    [displayField] => titulo
    [belongsTo] => Array
        (
            [Grupos_de_contenido] => Array
                (
                    [className] => Grupos_de_contenido
                    [foreignKey] => id_grupo_contenido
                    [conditions] =>
                    [fields] =>
                    [order] =>
                    [counterCache] =>
                )

        )

    [hasOne] => Array
        (
            [Pagina] => Array
                (
                    [className] => Pagina
                    [foreignKey] => id_contenido
                    [conditions] =>
                    [fields] =>
                    [order] =>
                    [dependent] =>
                )

        )

    [useDbConfig] => default
    [useTable] => contenidos
    [id] =>
    [data] => Array
        (
        )

    [table] => contenidos
    [_schema] => Array
        (
            [id] => Array
                (
                    [type] => integer
                    [null] =>
                    [default] =>
                    [length] => 11
                    [key] => primary
                )

            [id_grupo_contenido] => Array
                (
                    [type] => integer
                    [null] => 1
                    [default] =>
                    [length] => 11
                )

            [id_contenido_padre] => Array
                (
                    [type] => integer
                    [null] => 1
                    [default] =>
                    [length] => 11
                )

            [id_pagina] => Array
                (
                    [type] => integer
                    [null] => 1
                    [default] =>
                    [length] => 11
                )

            [solo_enlace] => Array
                (
                    [type] => boolean
                    [null] =>
                    [default] =>
                    [length] => 1
                )

            [titulo] => Array
                (
                    [type] => string
                    [null] => 1
                    [default] =>
                    [length] => 255
                )

            [imagen] => Array
                (
                    [type] => string
                    [null] => 1
                    [default] =>
                    [length] => 255
                )

            [url] => Array
                (
                    [type] => string
                    [null] => 1
                    [default] =>
                    [length] => 255
                )

            [prioridad] => Array
                (
                    [type] => integer
                    [null] => 1
                    [default] =>
                    [length] => 11
                )

            [publicado] => Array
                (
                    [type] => boolean
                    [null] => 1
                    [default] =>
                    [length] => 1
                )

        )

    [validate] => Array
        (
        )

    [validationErrors] => Array
        (
        )

    [tablePrefix] =>
    [alias] => Contenido
    [tableToModel] => Array
        (
            [contenidos] => Contenido
            [grupos_de_contenidos] => Grupos_de_contenido
            [paginas] => Pagina
        )

    [logTransactions] =>
    [transactional] =>
    [cacheQueries] =>
    [hasMany] => Array
        (
        )

    [hasAndBelongsToMany] => Array
        (
        )

    [actsAs] =>
    [Behaviors] => BehaviorCollection Object
        (
            [modelName] => Contenido
            [_attached] => Array
                (
                )

            [_disabled] => Array
                (
                )

            [__methods] => Array
                (
                )

            [__mappedMethods] => Array
                (
                )

            [_log] =>
        )

    [whitelist] => Array
        (
        )

    [cacheSources] => 1
    [findQueryType] =>
    [recursive] => 1
    [order] =>
    [__exists] =>
    [__associationKeys] => Array
        (
            [belongsTo] => Array
                (
                    [0] => className
                    [1] => foreignKey
                    [2] => conditions
                    [3] => fields
                    [4] => order
                    [5] => counterCache
                )

            [hasOne] => Array
                (
                    [0] => className
                    [1] => foreignKey
                    [2] => conditions
                    [3] => fields
                    [4] => order
                    [5] => dependent
                )

            [hasMany] => Array
                (
                    [0] => className
                    [1] => foreignKey
                    [2] => conditions
                    [3] => fields
                    [4] => order
                    [5] => limit
                    [6] => offset
                    [7] => dependent
                    [8] => exclusive
                    [9] => finderQuery
                    [10] => counterQuery
                )

            [hasAndBelongsToMany] => Array
                (
                    [0] => className
                    [1] => joinTable
                    [2] => with
                    [3] => foreignKey
                    [4] => associationForeignKey
                    [5] => conditions
                    [6] => fields
                    [7] => order
                    [8] => limit
                    [9] => offset
                    [10] => unique
                    [11] => finderQuery
                    [12] => deleteQuery
                    [13] => insertQuery
                )

        )

    [__associations] => Array
        (
            [0] => belongsTo
            [1] => hasOne
            [2] => hasMany
            [3] => hasAndBelongsToMany
        )

    [__backAssociation] => Array
        (
        )

    [__insertID] =>
    [__numRows] =>
    [__affectedRows] =>
    [_findMethods] => Array
        (
            [all] => 1
            [first] => 1
            [count] => 1
            [neighbors] => 1
            [list] => 1
            [threaded] => 1
        )

    [_log] =>
    [Grupos_de_contenido] => Grupos_de_contenido Object
        (
            [name] => Grupos_de_contenido
            [primaryKey] => id
            [displayField] => nombre
            [useTable] => grupos_de_contenidos
            [hasMany] => Array
                (
                    [Contenido] => Array
                        (
                            [className] => Contenido
                            [foreignKey] => id_grupo_contenido
                            [order] => Contenido.prioridad DESC,
Contenido.titulo ASC
                            [conditions] => Contenido.publicado = true
                            [fields] =>
                            [limit] =>
                            [offset] =>
                            [dependent] =>
                            [exclusive] =>
                            [finderQuery] =>
                            [counterQuery] =>
                        )

                )

            [useDbConfig] => default
            [id] =>
            [data] => Array
                (
                )

            [table] => grupos_de_contenidos
            [_schema] => Array
                (
                    [id] => Array
                        (
                            [type] => integer
                            [null] =>
                            [default] =>
                            [length] => 11
                            [key] => primary
                        )

                    [nombre] => Array
                        (
                            [type] => string
                            [null] => 1
                            [default] =>
                            [length] => 255
                        )

                    [opciones] => Array
                        (
                            [type] => string
                            [null] => 1
                            [default] =>
                            [length] => 255
                        )

                )

            [validate] => Array
                (
                )

            [validationErrors] => Array
                (
                )

            [tablePrefix] =>
            [alias] => Grupos_de_contenido
            [tableToModel] => Array
                (
                    [grupos_de_contenidos] => Grupos_de_contenido
                    [contenidos] => Contenido
                )

            [logTransactions] =>
            [transactional] =>
            [cacheQueries] =>
            [belongsTo] => Array
                (
                )

            [hasOne] => Array
                (
                )

            [hasAndBelongsToMany] => Array
                (
                )

            [actsAs] =>
            [Behaviors] => BehaviorCollection Object
                (
                    [modelName] => Grupos_de_contenido
                    [_attached] => Array
                        (
                        )

                    [_disabled] => Array
                        (
                        )

                    [__methods] => Array
                        (
                        )

                    [__mappedMethods] => Array
                        (
                        )

                    [_log] =>
                )

            [whitelist] => Array
                (
                )

            [cacheSources] => 1
            [findQueryType] => all
            [recursive] => 1
            [order] =>
            [__exists] =>
            [__associationKeys] => Array
                (
                    [belongsTo] => Array
                        (
                            [0] => className
                            [1] => foreignKey
                            [2] => conditions
                            [3] => fields
                            [4] => order
                            [5] => counterCache
                        )

                    [hasOne] => Array
                        (
                            [0] => className
                            [1] => foreignKey
                            [2] => conditions
                            [3] => fields
                            [4] => order
                            [5] => dependent
                        )

                    [hasMany] => Array
                        (
                            [0] => className
                            [1] => foreignKey
                            [2] => conditions
                            [3] => fields
                            [4] => order
                            [5] => limit
                            [6] => offset
                            [7] => dependent
                            [8] => exclusive
                            [9] => finderQuery
                            [10] => counterQuery
                        )

                    [hasAndBelongsToMany] => Array
                        (
                            [0] => className
                            [1] => joinTable
                            [2] => with
                            [3] => foreignKey
                            [4] => associationForeignKey
                            [5] => conditions
                            [6] => fields
                            [7] => order
                            [8] => limit
                            [9] => offset
                            [10] => unique
                            [11] => finderQuery
                            [12] => deleteQuery
                            [13] => insertQuery
                        )

                )

            [__associations] => Array
                (
                    [0] => belongsTo
                    [1] => hasOne
                    [2] => hasMany
                    [3] => hasAndBelongsToMany
                )

            [__backAssociation] => Array
                (
                )

            [__insertID] =>
            [__numRows] =>
            [__affectedRows] =>
            [_findMethods] => Array
                (
                    [all] => 1
                    [first] => 1
                    [count] => 1
                    [neighbors] => 1
                    [list] => 1
                    [threaded] => 1
                )

            [_log] =>
            [Contenido] => Contenido Object
 *RECURSION*
        )

    [Pagina] => Pagina Object
        (
            [name] => Pagina
            [primaryKey] => id
            [displayField] => titulo
            [useDbConfig] => default
            [useTable] => paginas
            [id] =>
            [data] => Array
                (
                )

            [table] => paginas
            [_schema] => Array
                (
                    [id] => Array
                        (
                            [type] => integer
                            [null] =>
                            [default] =>
                            [length] => 11
                            [key] => primary
                        )

                    [titulo] => Array
                        (
                            [type] => string
                            [null] => 1
                            [default] =>
                            [length] => 255
                        )

                    [descripcion] => Array
                        (
                            [type] => string
                            [null] => 1
                            [default] =>
                            [length] => 255
                        )

                    [contenido] => Array
                        (
                            [type] => text
                            [null] => 1
                            [default] =>
                            [length] =>
                        )

                    [id_contenido] => Array
                        (
                            [type] => integer
                            [null] => 1
                            [default] =>
                            [length] => 11
                        )

                )

            [validate] => Array
                (
                )

            [validationErrors] => Array
                (
                )

            [tablePrefix] =>
            [alias] => Pagina
            [tableToModel] => Array
                (
                    [paginas] => Pagina
                )

            [logTransactions] =>
            [transactional] =>
            [cacheQueries] =>
            [belongsTo] => Array
                (
                )

            [hasOne] => Array
                (
                )

            [hasMany] => Array
                (
                )

            [hasAndBelongsToMany] => Array
                (
                )

            [actsAs] =>
            [Behaviors] => BehaviorCollection Object
                (
                    [modelName] => Pagina
                    [_attached] => Array
                        (
                        )

                    [_disabled] => Array
                        (
                        )

                    [__methods] => Array
                        (
                        )

                    [__mappedMethods] => Array
                        (
                        )

                    [_log] =>
                )

            [whitelist] => Array
                (
                )

            [cacheSources] => 1
            [findQueryType] =>
            [recursive] => 1
            [order] =>
            [__exists] =>
            [__associationKeys] => Array
                (
                    [belongsTo] => Array
                        (
                            [0] => className
                            [1] => foreignKey
                            [2] => conditions
                            [3] => fields
                            [4] => order
                            [5] => counterCache
                        )

                    [hasOne] => Array
                        (
                            [0] => className
                            [1] => foreignKey
                            [2] => conditions
                            [3] => fields
                            [4] => order
                            [5] => dependent
                        )

                    [hasMany] => Array
                        (
                            [0] => className
                            [1] => foreignKey
                            [2] => conditions
                            [3] => fields
                            [4] => order
                            [5] => limit
                            [6] => offset
                            [7] => dependent
                            [8] => exclusive
                            [9] => finderQuery
                            [10] => counterQuery
                        )

                    [hasAndBelongsToMany] => Array
                        (
                            [0] => className
                            [1] => joinTable
                            [2] => with
                            [3] => foreignKey
                            [4] => associationForeignKey
                            [5] => conditions
                            [6] => fields
                            [7] => order
                            [8] => limit
                            [9] => offset
                            [10] => unique
                            [11] => finderQuery
                            [12] => deleteQuery
                            [13] => insertQuery
                        )

                )

            [__associations] => Array
                (
                    [0] => belongsTo
                    [1] => hasOne
                    [2] => hasMany
                    [3] => hasAndBelongsToMany
                )

            [__backAssociation] => Array
                (
                )

            [__insertID] =>
            [__numRows] =>
            [__affectedRows] =>
            [_findMethods] => Array
                (
                    [all] => 1
                    [first] => 1
                    [count] => 1
                    [neighbors] => 1
                    [list] => 1
                    [threaded] => 1
                )

            [_log] =>
        )

)

/********************************/

On Aug 31, 7:24 pm, brian <[email protected]> wrote:
> The only things that look odd are 'Prioridad' (should be lowercase?)
> 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<[email protected]> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to