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 <jeff....@unbiasedgeek.com> 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 cake...@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+u...@googlegroups.com .
> 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 cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
No comments:
Post a Comment