JSONAPI-Document
view release on metacpan or search on metacpan
1.9 2018-07-02 21:32:35+01:00 Europe/London
- Update readme
1.8 2018-07-02 21:27:14+01:00 Europe/London
- Fixed bug where requesting relationships for compound documents whose relationship
names contained underscores were not producing the right document type.
1.7 2018-06-24 16:44:22+01:00 Europe/London
- Fixed a bug where I was type checking for DBIx::Class::ResultSet, which made fetching
nested relationships not work for applications that layer over a dbix resultset. Made
the check less strict so now the overlaying class should just provide the "all" method.
1.6 2018-06-08 00:17:54+01:00 Europe/London
- Add missing dependency Test::MockObject
1.5 2018-06-04 22:36:07+01:00 Europe/London
- api_url case insensitive type check
1.4 2018-06-03 14:55:21+01:00 Europe/London
- REFACTOR
Undergone an internal refactoring that cleans up how the document is built.
lib/JSONAPI/Document/Builder/Compound.pm view on Meta::CPAN
}
# Note that this fetches the relationship on $self->row, so it shouldn't be done above.
foreach my $nested (@{ $self->nested_relationships }) {
my ($relation_source) = keys(%$nested);
my $result_ref =
$self->build_relationship($relation_source, $fields->{$relation_source}, { with_attributes => 1 })->{data};
if (ref($result_ref) eq 'ARRAY') { # The source relation is a has_many, link the nested resources for each one.
my $source_row = $self->row->$relation_source;
if ($source_row->can('all')) { # Check if any overlaying dbix resultset class can do "all"
my $includes =
$self->build_nested_from_resultset($source_row, $result_ref, $nested->{$relation_source}, $fields);
push @included, $_ for @$includes;
}
} else {
my $source_row = $self->row->$relation_source;
my %relationships;
foreach my $relationship (@{ $nested->{$relation_source} }) {
my $relationship_type = $self->format_type($relationship);
my ($related_data, $includes) = $self->build_nested_relationship(
( run in 0.683 second using v1.01-cache-2.11-cpan-49f99fa48dc )