I am creating a basic facebook type site for my first cake project,
just to learn it. I am having issues getting the save funciton to work
with my model relationships. Its very simple right now, the modle
Profile hasOne Info. The Info model belongsTo Profile and stores all
the contact information. I just have a model, no controller for Info
because all it needs to do is store data. In my Profile controller I
can't it to save the Info model correctly. It keeps creating new
database records and not updaitng the old one. Here is my code:
function account()
{
$temp = $this->Profile->findbyUserId($this->Session-
>read('user_id'));
$this->set('info',$this->Profile->Info-
>findbyProfileId($temp['Profile']['id']));
if (!empty($this->data))
{
if($this->Profile->Info->save($this->data))
{
$this->Profile->Info->saveField('profile_id',
$temp['Profile']['id']);
$this->set("success", "true");
}
}
}
Also, its not saving my foreign keys so I have to manually save
profile_id after, I'm completely new so I don't know if I'm missing
out on anything. Should I have to do that every time? Any help is
appreciated. I am using the latest stable version of 1.1.
Thanks,
Dave
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---