Please can anybody help! I can retrieve or save to my models.

Two tables users and roles and join table roles_users

Thes are my models

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

    var $recursive = '2';

     var $validate = array(
    'username' => VALID_EMAIL, 'password' =>
VALID_NOT_EMPTY,'first_name' => VALID_NOT_EMPTY,
        'last_name' => VALID_NOT_EMPTY);

        var $hasAndBelongToMany = array('Role' =>
        array('classname' => 'Role',
        'jointable'=> 'roles_users',
        'foreignKey' => 'user_id',
        'associationForeignKey' => 'role_id',
        'condition'=>'',
        'order' => 'Role.name ASC',
        'limit'=> '',
        'uniq' => 'True',
        'finderSql' => '',
        'deleteQuery' => '')
        );


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



     var $validate = array(
    'name' => VALID_NOT_EMPTY, 'description' => VALID_NOT_EMPTY);

    var $hasAndBelongToMany = array('User' =>
        array('classname' => 'User',
        'jointable'=> 'roles_users',
        'foreignKey' => 'role_id',
        'associationForeignKey' => 'user_id',
        'condition'=>'',
        'order' => '',
        'limit'=> '',
        'uniq' => '',
        'finderSql' => '',
        'deleteQuery' => '')
        );


I know i should use ACL for  this but just trying out to  get good
grasp of the association.

when i save a new user i want a record added to the join table based on
a default role.

what am i doing wrong?


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

Reply via email to