Wednesday, September 2, 2009

id is getting lost inside ClassRegistry::init. BUG?!

Am I wrong or is id dropped inside init funtion in /cake/libs/
class_registry.php ?!

I'm trying to load a model on the fly. I can pass a id to the function
like:

ClassRegistry::init( array('class' => 'User', 'id' => $id), 'Model' );

But inside the function init the id is never handled. Since this the
id is always the lowest available (mostly 1).


This is especially questionable because the example in the manual
(http://book.cakephp.org/view/845/loadModel) doesn't work:

$this->loadModel('User', 2);
$user = $this->User->read();

loadModel is using ClassRegistry::init -> Id will be lost.

Am I wrong? please correct me.

Johannes

--~--~---------~--~----~------------~-------~--~----~
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: