Yes, exactly :) Using CakePHP models, the result is:
Location hasMany Job
Location hasMany Shop

But are each Job independent of Shop?
Enjoy,
   John

On Jan 10, 1:31 am, loke <developer.l...@gmail.com> wrote:
> Or may be, I do not even need a reference table in the middle, because
> there is a singular relationship between each pair of models. So
> storing the id of the location in each table should be enough to refer
> to the correct location. It is a many-to-one relationship.
>
> Thanks
> Loke
>
> On Jan 9, 6:27 pm, loke <developer.l...@gmail.com> wrote:
>
> > Well, the situation is like this:
> > Locations(id, location_info) is an independent table to store all
> > relevant locations.
> > Jobs (id, name, location_id) is a table that has exactly one location
> > for each job, and stores the location_id from location(id).
> > Shops(id, name, location_id) is another table that has exactly one
> > location for each shop, and stores the location_id from location(id).
>
> > I do understand that I need to have a reference table in the middle of
> > each relationship, but am unable to find a definable relationship
> > within the scope of CakePHP. HABTM seems to be the closest option, but
> > may be I need something different.
>
> > Thanks
> > Loke
>
> > On Jan 8, 2:28 pm, John Andersen <j.andersen...@gmail.com> wrote:
>
> > > What are the requirements for Model3?
> > > Must there be a relationship to Model2 if there is a relationship to
> > > Model1 and vice versa?
> > > Enjoy,
> > >    John
>
> > > On Jan 8, 9:05 pm, loke <developer.l...@gmail.com> wrote:
>
> > > > I have a relational requirement where more than one models are related
> > > > to another model.
>
> > > > I want to define the relations with an index table for each
> > > > relationship between the two models.
>
> > > > Model1 -> Model1_Model3_index -> Model3
>
> > > > Model2 -> Model2_Model3_index -> Model3
>
> > > > I could see HABTM to be a solution, but the relationship between
> > > > Model1-> Model3 and Model2->Model3 has to be a 1 -to- n relationship.
>
> > > > Thanks
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to