[Dbix-class] many_to_many data access

Patrick Meidl patrick at pantheon.at
Fri Jul 13 09:48:20 GMT 2012


On Fri, Jul 13 2012, Dave Howorth <dhoworth at mrc-lmb.cam.ac.uk> wrote:

> Patrick Meidl wrote:
> 
> > there are two reasons why you want to model the relationship city ->
> > state -> country in such a rigid (and maybe simplified) way:
> > 
> > first, it helps you maintain data integrity. after all, you don't want
> > anybody to enter a store which is in Paris, Bavaria, UK, right?
> 
> But you do want them to be able to enter Paris, France as well as Paris,
> Texas, USA. :-P

sure, but even if you model your data as I described, that would still
be possible: you would have two city entities called "Paris", each
linked to the respective state/country.

> And in Germany, the state (Land) is not part of the address, AFAIK, so
> Bavaria, or Freistaat Bayern, will never appear. And it's most
> definitely not right to have to write Singapore, Singapore, Singapore
> as an address. So I think some more flexibility is required, as others
> have suggested.

good point. the fact that in most countries (except the US) states are
irrelevant for address purposes is certainly a goog argument for not
linking cities to countries via states.

but as I said, I don't think there is one good way to represent this
data, it will always depend on your actual problem.

    patrick

-- 
Patrick Meidl ........................ patrick at pantheon.at
Vienna, Austria ...................... http://gplus.to/pmeidl




More information about the DBIx-Class mailing list