Monday, November 1, 2010

Anything wrong with this?

User hasOne Profile , Profile belongsTo User

 

But in my Profile table I do not have user_id, I just have id which is the User.id created automatically when the User creates an account. To me it seems like why give the Profile a separate ID when essentially its just an extension of the User.

Everything else is related to the Profile

 

Profile:

var $belongsTo = array(

'User' => array(

                                'className' => 'User',

                                'foreignKey' => 'user_id')                            

);

 

User:

var $hasOne = array(

'Role' => array(

                                'className' => 'Role',

                                'foreignKey' => 'id',

                                'dependent' => false),

                'Profile' => array(

                                'className' => 'Profile',

                                'foreignKey' => 'id',

                                'dependent' => false)

);

 

Is this set up wrong?

 

Thanks,

 

Dave

No comments: