|Syntactic Confectionery Delight|
DBIx::Class - shortcutting relationships [resolved]by cLive ;-) (Prior)
|on Oct 04, 2012 at 18:21 UTC||Need Help??|
cLive ;-) has asked for the
wisdom of the Perl Monks concerning the following question:
UPDATE: I was being brain dead, but leaving this question up because I see no way to delete it...
If I have 3 tables (league, team and league_team), with the following relationships:
league has one to many league_team
with league,team being the PK on the league_team table.
What I want to build is so the following will work (say) for a league):
With my current relationship across the three tables though, I have to use this:
I'm guessing also, that there's going to need to be an implicit create on the league_team entry wrapped in the term:$league->team->create()
I can easily hack the interface I want, but I'm assuming that there is a correct way to do this in DBIx::Class. What is it? Anyone got a working example I can look at for inspiration?
Oh, I found this module, but I'm not quite getting it, if that is indeed the solution.
Note, refactoring the tables is not something I have access to right now.
Edit: I think I've found the term I was looking for - relationship_bridge. Now I just need to find an example, heh. The hardest part of any quest is working out what you're looking for, heh