Hello. I need to make an association between the model User and the
model Pack. I have the three tables (users, packs and packs_users).
The thing is users can add the same pack 12 times a day. It means the
User and Pack record will remain the same but the record at the table
packs_users would repeat 12 times (and have a date field), but cake
won't write the relation because it already exists.
Am I using the right relation type? Do you have any clue on how to
make this work? And what is the "unique" option for?

This is the relation declaration in the models:


class User extends AppModel {

        var $name    = "User";
        var $hasOne  = array('UserConfig', 'Score');
        var $hasAndBelongsToMany = array(
        'Pack' =>
            array('className'           => 'Pack',
                'joinTable'             => 'packs_users',
                'foreignKey'            => 'user_id',
                'associationForeignKey' => 'pack_id',
                'conditions'            => '',
                'order'                 => '',
                'limit'                 => '',
                'unique'                => false,
                'finderQuery'           => '',
                'deleteQuery'           => '',
                'insertQuery'           => ''
            )
        );
[...]


class Pack extends AppModel {

        var $name                = "Pack";
        var $useTable            = "packs";
        var $hasAndBelongsToMany = array(
        'User' =>
            array('className'           => 'User',
                'joinTable'             => 'packs_users',
                'foreignKey'            => 'pack_id',
                'associationForeignKey' => 'user_id',
                'conditions'            => '',
                'order'                 => '',
                'limit'                 => '',
                'unique'                => false,
                'finderQuery'           => '',
                'deleteQuery'           => '',
                'insertQuery'           => ''
            )
        );
[...]


Thanks in advance.

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