Re: ClassRegistry bug?

2008-01-28 Thread Ivan

Thanks for giving attention to this Gwoo.

I was trying to find where is documented the use of unique aliases
across different models on the tickets and couldn't find it.

After some searching I found this bug: https://trac.cakephp.org/ticket/3584
The behavior reported here is exactly the same I'm encountering.
According to the bug resolution the code should work, however I can't
make the example code to work.

I think the following section of ClassRegistry is causing the loop:

00246 if ($_this->isKeySet($alias)) {
00247 $model = $_this->getObject($alias);
00248 if (is_a($model, $class)) {
00249 $duplicate = true;
00250 }
00251 unset($model);
00252 }

which in my case always returns false.

Thanks in advance for any help anyone can give on this.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: ClassRegistry bug?

2008-01-28 Thread Gwoo

You must have unique aliases in for your associated models. If you
search the tickets you will find that this has been reported and
closed.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: ClassRegistry bug?

2008-01-28 Thread Ivan

btw I'm using:

Cake 1.2.0.6311 beta

PHP 5.2.4-2+b1 with Suhosin-Patch 0.9.6.2 (cli) (built: Jan  6 2008
23:43:13)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

mysql  Ver 14.12 Distrib 5.0.51, for debian-linux-gnu (i486) using
readline 5.2


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



ClassRegistry bug?

2008-01-27 Thread Ivan

I just found a problem with the way ClassRegistry handles aliases for
associations. I wonder why nobody else has reported it, so it may be
my fault.

I have two models:

class FirstObject extends AppModel {
public $belongsTo = array(
'Parent' => array(
'className' => 'FirstObject',
'foreignKey' => 'parent_id',
)
);
public $hasMany = array(
'Children' => array(
'className' => 'FirstObject',
'foreignKey' => 'parent_id'
),
'SecondObject'
);
}

class SecondObject extends AppModel {
public $belongsTo = array(
'Parent' => array(
'className' => 'SecondObject',
'foreignKey' => 'parent_id',
),
'FirstObject'
);
public $hasMany = array(
'Children' => array(
'className' => 'SecondObject',
'foreignKey' => 'parent_id'
)
);
}

A simple FirstObject->findAll() results in a blank page caused by an
endless loop inside ClassRegistry. It seems this is because
ClassRegistry uses the alias of the association as a key.

Is something wrong with my setup or is indeed a bug with ClassRegistry
if you use the same aliases for different classes?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---