My problem is that every time i update my profile, it does an insert
instead of an update sql command. Is my associations incorrect ?

Thanks.

class Member extends AppModel
{
        var $name = 'Member';
        var $hasOne = array('Profile' =>
                                array('className'    => 'Profile',
                                      'conditions'   => '',
                                      'order'        => '',
                                      'dependent'    =>  true,
                                      'foreignKey'   => 'member_id'
                                )
                  );
}
----------
class Profile extends AppModel {
        var $name = 'Profile';
        var $belongsTo = array('Member' =>
                                   array('className'  => 'Member',
                                         'conditions' => '',
                                         'order'      => '',
                                         'foreignKey' => 'member_id'
                                   )
                     );
}
-----------------
        function editprofile()
        {
                if (empty($this->data))
                {
                        
$this->set('attribute_id_activitylevel',$this->Attribute-
>generateList(array('name' => 'ActivityLevel'), 'id ASC', 0,
'{n}.Attribute.id', '{n}.Attribute.value'));
                        $this->set('attribute_id_appearance',$this->Attribute-
>generateList(array('name' => 'Appearance'), 'id ASC', 0,
'{n}.Attribute.id', '{n}.Attribute.value'));
                        
$this->set('attribute_id_attractivefeatures',$this->Attribute-
>generateList(array('name' => 'AttractiveFeatures'), 'id ASC', 0,
'{n}.Attribute.id', '{n}.Attribute.value'));
                        $this->Member->id = $this->Authentication->getId();
                        $this->set('data', $this->Member->read());
                        $this->render();
                }
                else
                {
                        if ($this->Profile->validates($this->data))
                        {
                                $this->Member->id = 
$this->Authentication->getId();
                                $this->data['Profile']['member_id'] = 
$this->Authentication-
>getId();
                                $this->Profile->save($this->data);
                                die;
                        }
                        else
                        {
                                $this->validateErrors($this->Profile);
                                $this->render();
                        }
                }
        }


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

Reply via email to