Sunday, January 29, 2012

Associations & model linking

Hi everybody!
I want to know if i'm doing things right, please!
I have 3 kind of users: admin,teacher,students, so i've created 3
different groups (for ACL).

For the users, I've made 3 separated tables: users (for login),
teachers, and students.

So:
Users $belongsTo Group
teachers $belongsTo Users
teachers $hasMany users
students $belongsTo User
students $belongsTo teacher

Ok?

Recap:
-Users: id,user,password,teachers_id,students_id,group_id
-Teachers:id, ..stuff.. , user_id
-Students:id, ..stuff.., teachers_id, user_id

Is this correct?
Thanks :)

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: