I'd put capital_id fields on tables contry and state. I don't like
having a field that is 0 most of the time.

Or, if you want to model countries like the netherlands or south
africa, that have administrative, legislative and financial (i guess)
capitais in different cities , you should have a country_capitals
table.

Dfcp

On 24 ago, 22:03, cricket <[email protected]> wrote:
> On Tue, Aug 24, 2010 at 7:57 PM, DerBjörn <[email protected]> wrote:
> > Thanks j,
>
> > for your example and your suggestions.
> > I think I will go with the tinyint. What about the idea to use
> > is_state_capital and is_capital? Wouldnt this solve the problem?
>
> This looks like it's getting really complicated for nothing. These
> tinyint columns seem like a bad hack. As I mentioned earlier, you can
> do this simply with virtual models, NationalCapital and StateCapital.
> Each would use classname City.
>
> > Can a city be capital of a country and not of its state? I dont think
> > so. Can it? cause then one tinyint with 1 as state capital and 2 as
> > capital of country would be enough. and an unique key(state_id,
> > is_capital)...
>
> Of course it can. Ottawa is a good example. Toronto is the Ontario
> provincial capital.

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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to