Well, sort of, if your model is set up like this:
<?php
class User extends AppModel {
var $name = 'User';
var $hasOne = array('Profile');
}
?>
You should be able to use the model "Profile" in your controller like
this:
if($this->User->save($this->data['User'])) {
$this->User->Profile->save($this->data['Profile']);
}
But you can use bindModel for this as well. Same concept, just a
different way of doing it.
I haven't seen any benchmarks on this subject. I just know that it
works. I wish I had time to do it because a ton people would be
interested in the subject (and thus I'd get a ton of traffic to my
website). Anyone out there want to take this on? I'll have time to do
it in about 2 months : ).
On Jul 30, 3:20 am, phpjoy <[EMAIL PROTECTED]> wrote:
> i think that he ment to use the bindmodel() instead of loading a new
> model..
>
> user->profile->func();
> instead of
> loadModel('user');
> loadModel('profile');
>
> i wondered what's the performance difference.
>
> On Jul 30, 1:30 am, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> > On Jul 29, 4:45 pm, housebolt <[EMAIL PROTECTED]> wrote:
>
> > > $usesiseviland should be sparsely used.
>
> > Do you have any benchmarks to back this up, or any comments from the
> > core Cake developers (ie PHPNut or Nate) to this effect? I have not
> > heard this before, and it sounds like FUD. I use loadModel heavily in
> > my code and do not notice any particular performance hit (and afaik
> > loadModel is basically the same as $uses). Cake model instances are
> > cached in the ClassRegistry, and I was under the impression these
> > existing instances were used for associations and $useswhere
> > possible.
>
> > Certainly there is some performance hit to loading in Model classes
> > (and it shouldn't be done unnecessarily), but unless you have some
> > further proof I don't believe this is any worse whether they are
> > loaded through associations, through $uses, or through loadModel.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---