Hi.. I have a problem with HABTM relation...
I have two types of users "parent" and "student"(child of the parent)
stored in one table named "users". Field in this table named "type"
defines which type of user it is.

Fields in table "users":
  `id` int(11)
  `type` enum('a','t','p','s') //a - admin, t - teacher, p - parent, s
- student(child)
  `name` varchar(60)
  `surname` varchar(60)
  `login` varchar(16)
  `password` char(40)

Fields in table used to join named "childrensparents"
  `id` int(11) auto_increment,
  `parent_id` int(11) // foreign key identifying unique user from
table "users" (which has "type" field set as 'p')
  `child_id` int(11) // foreign key identifying unique user from table
"users" (which has "type" field set as 's')

...so both foreign keys are "linked" to the same table ("user")

I have to define parent-child relation in "User" model, assuming that
one parent can have many children(students) and one child(student)
belongs to one or more parents....

I have no idea how to define "$hasAndBelongsToMany" relation in this
case (being honest i never used this type of ralation before, i'm
working with cakePHP since two months, so many things are new to my)

I'll be grateful for any help....
Thankyou to all 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