[Dbix-class] many_to_many data access

fREW Schmidt frioux at gmail.com
Thu Jul 12 13:04:42 GMT 2012


On Thu, Jul 12, 2012 at 2:48 AM, Patrick Meidl <patrick at pantheon.at> wrote:

> first, to get the cities associated to the store, use the many_to_many
> relationship you defined; if you have such a relationship, you usually
> never use the bridging table (store_cities in your example) directly.
>

I disagree.  The use of data other than left_id and right_id is what makes
many_to_many jointables so awesome.  The obvious data to put in the join
table is the date the intermediate was created, or often which user added
it.  Once I created a DB that was supposed to represent judges in the US.
It had tables for Military Rank and Military Service and then a join table
that joined the judge to those two and it had start dates and end dates
etc.  That db had a total of 14~ join tables, nearly all of which had
intermediate data.  It's a very handy and powerful pattern.

-- =

fREW Schmidt
http://blog.afoolishmanifesto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20120712/9f6=
b6cb0/attachment.htm


More information about the DBIx-Class mailing list