[Dbix-class] has_one over joining table

Andrew Beverley andy at andybev.com
Tue Jan 30 09:22:39 GMT 2018


On Tue, 30 Jan 2018 09:42:26 +0100 Stuart Dodds wrote:
> > You would then do something like:
> > 
> > $town->town_people_mayor->mayor
> 
> Hi Andy,
> 
> Yes, that works perfectly...thank you!

You're welcome!

> It would have been nice to do it in one step as I wouldn't need to
> change the calling side...

Well, you could always add a short-cut in your Result::Town result
class. E.g.

  sub mayor { shift->town_people_mayor->mayor }

Andy



More information about the DBIx-Class mailing list