Re: relationship between Sate and City
Thanks a lot Deek. :) I wasn't able to populate the state combo box
due to incorrect relationships between models. Now everything is
working fine.
It is so impt to make sure all models are linked to one another.
Otherwise nothing works.
On Jul 7, 6:24 am, Deek <rdiek...@gmail.com> wrote:
> You don't need to set a foreign key inStateforCity. By adding the
> state_id column in yourcitytable you are establishing the hasMany,StatehasManyCity, and the belongsTo,CitybelongsToState. Just set
> the hasMany and belongsTo properly inStateandCityrespectively and
> the relationship should work.
>
> On Jul 6, 8:49 pm, varai <vaanip...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > I am trying to define relationship betweenstateandcity.
>
> >StatehasManyCity-- foreign key state_id inCity
> >CitybelongsToState
>
> >Statefields: id, state_name
> >Cityfields: id, city_name, state_id
>
> > but forCitybelongsToState, it seems illogically to set a foreign
> > key inStatecoz' thenStaterecords will be repeating.
>
> > What is the best way to go about this?
>
> > thank you.
--
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home