On Feb 9, 7:57 am, Henrik Gemal <[email protected]> wrote:
> I'm not sure what the "most" correct way to dynamicly load a model is:
>
> ClassRegistry::init("model_name")
> or
> loadModel("model_name")
>
> ?
I use App::Import if I'm going to use a model instance more than once.
Otherwise ClassRegistry::init can be used for one-time usage (e.g.
ClassRegistry::init("Foo")->find("all");).
However, you should make sure you are not loading a model in which
the current model (of your controller) has an association with. If it
does, then you can just do $this->Bar->Foo->find("all"); instead if
"Bar" is the current model.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---