Hi! I'm beginner with cakephp.
I have two objets linked with "hasAndBelongsToMany" association :

VERSION MODEL
*******************************************************************************************

class Version extends AppModel {
    var $name = 'Version';

    var $hasAndBelongsToMany = array('Tab' =>
                                                                   
array('className'    => 'Tab',
                                                                                
 'joinTable'    => 'tabs_versions',
                                                                                
 'foreignKey'   => 'version_id',
                                                                                
 'associationForeignKey'=> 'tab_id',
                                                                                
 'unique'       => true
                                                                   )
                                                                );
}

TAB MODEL
*******************************************************************************************

class Tab extends AppModel {
    var $name = 'Tab';


    var $hasAndBelongsToMany = array('Version' =>
                                                                   
array('className'    => 'Version',
                                                                                
 'joinTable'    => 'tabs_versions',
                                                                                
 'foreignKey'   => 'tab_id',
                                                                                
 'associationForeignKey'=> 'version_id',
                                                                                
 'unique'       => true
                                                                   )
                               );
}

**********************************************************************************************************

I would like to make a new "tab" without form.
My problem : The new tab is created, but the association in the table
named "tabs_versions" (in database) isn't created.

My actual php code (in controller) :

        $to_save = array();
        $to_save['Version'] = array(
                                                        'id'    => 
$this->data['Version']['id']
                                                );
        $to_save['Tab'] = array(
                                                'title'         => '(Onglet)',
                                                'position'      => 
($position['0']['0']['position']+1)
                                        );
        $this->Tab->save($to_save, true);


How can I do ?
Thanks a lot!

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