If i only use die(debug($this->alias)); I got the Grupos_de_contenido
It means what the error occurs is not in the first time what
getColumnType function is called. Then the die(debug($this->
{$model})); is killing the application before what the error occurs.
function getColumnType($column) {
$db =& ConnectionManager::getDataSource($this->useDbConfig);
$cols = $this->schema();
$model = null;
$column = str_replace(array($db->startQuote, $db->endQuote), '',
$column);
if (strpos($column, '.')) {
list($model, $column) = explode('.', $column);
}
if ($model != $this->alias && !empty($model) && isset($this->
{$model})) { // Line 948
return $this->{$model}->getColumnType($column);
}
I Added the lines:
if(!isset($model) || empty($model))
{ die('Is $this->{$model} = "'. $model . '" on
' . $this->alias); }
to know what values are in the variables ($this->alias, $this->
($model)) when the error occurs. I got:
Is $this->{$model} = "" on Contenido
Only I create a new not empty condition for $model, before try $this->
{$model} and all works fine.
Thanks again.
On Sep 1, 11:25 am, brian <bally.z...@gmail.com> wrote:
> I don't suggest that you modify the core files like that. It will lead
> to problems down the road when you want to upgrade. The hint to put
> the debug statements in there was just that--for debugging. It would
> be better to track down precisely what the problem is in your own
> code. The thing is, I'm having some trouble understanding what it is
> you did.
>
> if(!isset($this->alias) || empty($this->alias))
> { die('Es $this->alias'); }
> if(!isset($model) || empty($model))
> { die('Is $this->{$model} = "'. $model . '" on
> ' . $this->alias); }
>
> Is $this->{$model} = "" on Contenido
>
> So, $model is empty. But, die(debug($this->{$model})); gives you a
> nice bunch of information. So, I'm confused. Maybe I'm not the best
> person to investigate this.
>
> One thing: Grupos_de_contenido should *maybe* be GruposDeContenido.
> I've no idea if it's related.
>
> On Tue, Sep 1, 2009 at 11:48 AM, logislack<jhac...@gmail.com> wrote:
>
> > Hi brian
>
> > I solved the problem:
>
> > if ($model != $this->alias && !empty($model) && isset($this->
> > {$model})) { // Line 948
> > return $this->{$model}->getColumnType($column);
> > }
>
> > instead:
> > if ($model != $this->alias && isset($this->{$model})) { // Line 948
> > return $this->{$model}->getColumnType($column);
> > }
>
> > This in order to avoid running $this->{$ model} if $model is empty
>
> > Thanks again!
>
> > On Aug 31, 7:24 pm, brian <bally.z...@gmail.com> 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<jhac...@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