Add eager fetching of relations and enable that for jobset->jobsetinputs
Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
@ -23,6 +23,11 @@ sub TO_JSON {
|
||||
$json{$relname} = [ map { $_->$key } $self->$relname ];
|
||||
}
|
||||
|
||||
foreach my $relname (keys %{$hint->{eager_relations}}) {
|
||||
my $key = $hint->{eager_relations}->{$relname};
|
||||
$json{$relname} = { map { $_->$key => $_ } $self->$relname };
|
||||
}
|
||||
|
||||
return \%json;
|
||||
} else {
|
||||
my $json = { $self->get_columns };
|
||||
|
@ -153,4 +153,14 @@ __PACKAGE__->has_many(
|
||||
# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-10-08 13:06:15
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+mZZqLjQNwblb/EWW1alLQ
|
||||
|
||||
my %hint = (
|
||||
relations => {
|
||||
"jobsetinputalts" => "value"
|
||||
}
|
||||
);
|
||||
|
||||
sub json_hint {
|
||||
return \%hint;
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -309,7 +309,7 @@ __PACKAGE__->has_many(
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:DTAGxP5RFvcNxP/ciJGo4Q
|
||||
|
||||
my %hint = (
|
||||
relations => {
|
||||
eager_relations => {
|
||||
jobsetinputs => "name"
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user