Re: should teacher and student stay together???

2011-05-05 Thread Tan Cheng
Thanks for everyone's help. great informations, learned a lot.

On May 2, 11:29 am, philp  wrote:
> Hi there,
>
> you could also use this behavior:
>
> https://github.com/Theaxiom/Polymorphic2.0
>
> On 29 avr, 17:28, Tan Cheng  wrote:
>
>
>
>
>
>
>
> >so there is a HABTM relationship between students and teachers.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: should teacher and student stay together???

2011-05-03 Thread philp
Hi there,

you could also use this behavior:

https://github.com/Theaxiom/Polymorphic2.0

On 29 avr, 17:28, Tan Cheng  wrote:
>so there is a HABTM relationship between students and teachers.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: should teacher and student stay together???

2011-04-30 Thread stas kim
i believe the term your are looking for is 'self referential habtm'
goole for it. there are plenty examples

On Fri, Apr 29, 2011 at 1:53 PM, cricket  wrote:
> On Fri, Apr 29, 2011 at 11:28 AM, Tan Cheng  wrote:
>> Hi all,
>>
>> A very basic question, I naively believe that there's no dumb
>> question...
>>
>> I'm creating a database, and the users are categorized into teachers
>> and students, obviously, one student has and belongs to many teachers
>> and vice versa, so there is a HABTM relationship between students and
>> teachers.
>>
>> So in cake, which is the better approach?
>>
>> 1) Put them in the "users" table and use a field to distinguish
>> students and teachers, but how do I describe the HABTM relationship
>> between them? Do I need to create a "students_teachers" table?
>
> You could add 2 columns to your users table, model & foreign_key. The
> students & teachers tables can also have a user_id column to associate
> back the other way.
>
>> 2) Create three tables, "students", "teachers", and a
>> "students_teachers" table.
>
> Yes, do that as well. These are not mutually exclusive.
>
> --
> 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+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php
>

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: should teacher and student stay together???

2011-04-29 Thread cricket
On Fri, Apr 29, 2011 at 11:28 AM, Tan Cheng  wrote:
> Hi all,
>
> A very basic question, I naively believe that there's no dumb
> question...
>
> I'm creating a database, and the users are categorized into teachers
> and students, obviously, one student has and belongs to many teachers
> and vice versa, so there is a HABTM relationship between students and
> teachers.
>
> So in cake, which is the better approach?
>
> 1) Put them in the "users" table and use a field to distinguish
> students and teachers, but how do I describe the HABTM relationship
> between them? Do I need to create a "students_teachers" table?

You could add 2 columns to your users table, model & foreign_key. The
students & teachers tables can also have a user_id column to associate
back the other way.

> 2) Create three tables, "students", "teachers", and a
> "students_teachers" table.

Yes, do that as well. These are not mutually exclusive.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


should teacher and student stay together???

2011-04-29 Thread Tan Cheng
Hi all,

A very basic question, I naively believe that there's no dumb
question...

I'm creating a database, and the users are categorized into teachers
and students, obviously, one student has and belongs to many teachers
and vice versa, so there is a HABTM relationship between students and
teachers.

So in cake, which is the better approach?

1) Put them in the "users" table and use a field to distinguish
students and teachers, but how do I describe the HABTM relationship
between them? Do I need to create a "students_teachers" table?

2) Create three tables, "students", "teachers", and a
"students_teachers" table.

Any help really appreciated!!!

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php