Hi all, 

i have a $hasAndBelongsToMany relationship between 'clubs' and
'competitions'.

Now when I create a 'competition' i can allocate many clubs to it and save
it and it saves correctly.

The default for any newly created item is active=0, so after adding I want
to activate the competition and when doing this it deletes all the
associations between all the newly created competitions and the clubs
associated. Im not sure why this is happening:

                        $this->Competition->saveField('active', '1');

The competition model is defined as follows:

var $hasAndBelongsToMany = array(
                        'Club' => array('className' => 'Club',
                                                'joinTable' => 
'competitions_clubs',
                                                'foreignKey' => 
'competition_id',
                                                'associationForeignKey' => 
'club_id',
                                                'unique' => true,
                                                'conditions' => 'Club.active = 
1',
                                                'fields' => '',
                                                'order' => 'Club.name',
                                                'limit' => '',
                                                'offset' => '',
                                                'finderQuery' => '',
                                                'deleteQuery' => '',
                                                'insertQuery' => ''
                        )
        );

where am I going wrong?

thanks
Angelo



-- 
View this message in context: 
http://www.nabble.com/saveField-removes-associations-tp20656915p20656915.html
Sent from the CakePHP mailing list archive at Nabble.com.


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

Reply via email to