hi

I'm using 1.2 beta

I have 3 models: game, game_background and game_genre
game habtm game_background and game habtm game_genre (see the models
code below)

to explain my problem, I'll take an example, will be easier

result of pr($this->data) in Game model / beforeSave():
Array
(
    [Game] => Array( // some datas )
    [GameGenre] => Array([GameGenre] => Array([0] => 3 [1] => 4))
    [GameBackground] => Array([GameBackground] => Array([0] => 9 [1]
=> 6))
)

there, datas are ok, I linked this game with 2 genres and 2
backgrounds
but when the save is done, in my DB I have these records:
- in game_genres_games, the game is linked with 3 and 4, it's ok
- in game_backgrounds_games, the game is linked with 3, 4, 6 and 9,
there's a problem !!

I really don't understand this behaviour...
one relationship works well but not the other one... ???

thanks in advance for your help

Models code:

class Game extends AppModel {
        var $hasAndBelongsToMany = array(
                'GameBackground' => array(
                        'className'                             => 
'GameBackground',
                        'joinTable'                             => 
'game_backgrounds_games',
                        'foreignKey'                    => 'game_id',
                        'associationForeignKey' => 'game_background_id',
                        'unique'                                => true,
                ),
                'GameGenre' => array(
                        'className'             => 'GameGenre',
                        'joinTable'                     => 'game_genres_games',
                        'foreignKey'                    => 'game_id',
                        'associationForeignKey' => 'game_genre_id',
                        'unique'                        => true,
                )
        );
}

class GameGenre extends AppModel {
        var $hasAndBelongsToMany = array(
                'Game' => array(
                        'className'             => 'Game',
                        'joinTable'                     => 'game_genres_games',
                        'foreignKey'                    => 'game_genre_id',
                        'associationForeignKey' => 'game_id',
                        'unique'                        => true,
                )
        );
}

class GameBackground extends AppModel {
        var $hasAndBelongsToMany = array(
                'Game' => array(
                        'className'             => 'Game',
                        'joinTable'                     => 
'game_backgrounds_games',
                        'foreignKey'                    => 'game_background_id',
                        'associationForeignKey' => 'game_id',
                        'unique'                        => true,
                )
        );
}

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