On 29/01/18 17:31, Andrew Beverley wrote:
> Something like (in Result::Town):
>
> __PACKAGE__->might_have(
> "town_people_mayor",
> "MyApp::Schema::Result::TownPeople",
> sub {
> my $args = shift;
> return {
> "$args->{foreign_alias}.town_id" => { -ident =>
> "$args->{self_alias}.id" },
> "$args->{foreign_alias}.is_mayor" => 1,
> };
> }
> );
>
> You would then do something like:
>
> $town->town_people_mayor->mayor
Hi Andy,
Yes, that works perfectly...thank you!
It would have been nice to do it in one step as I wouldn't need to
change the calling side...but I blame myself for coming up with a shabby
db structure in the first place ;)
Thanks again for your help,
Stuart
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]