Why what I want to make a model called PrerequisiteCourses? The courses themselves are the links. The way I was trying to do it was with a courses table and a courses_courses HABTM table. The problem is foreign keys in HABTM table would require field_id to point back to the respective columns.
So you could have a table called recipes that have the fields (id, name) and a table called ingredients with the fields (id, name) and a third table called ingredients_recipes with the fields (id, recipe_id, ingredient_id). Then cakephp will let you setup a HABTM many relations ship. In my scenario that two tables are the same table and key off the same field. On Tuesday, August 28, 2012 6:25:01 AM UTC-6, Dr. Tarique Sani wrote: > > You can create a model called PrerequisiteCourses which uses the > courses table and then relate Courses habtm PrerequisiteCourses. I > will leave it to you to figure out how to make the join table ;-) > > HTH > > Tarique > > On Tue, Aug 28, 2012 at 4:35 PM, Archeious > <[email protected]<javascript:>> > wrote: > > So I have a list of courses. Some of those courses have prerequisites > that > > are also courses. So I setup a model called Course and a database table > > called courses. I have another model called CoursesCourse and a table > > called courses_courses. How would I setup it up so view I view a course > I > > get its info and the course it requires (and if possible the courses > > required by it)? > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "CakePHP" group. > > To post to this group, send email to [email protected]<javascript:>. > > > To unsubscribe from this group, send email to > > [email protected] <javascript:>. > > Visit this group at http://groups.google.com/group/cake-php?hl=en-US. > > > > > > > > -- > ============================================================= > PHP for E-Biz: http://sanisoft.com > ============================================================= > -- 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]. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
