| 1 | # ABSTRACT: DAO request - retrieve relationships | ||||||||||||||||||||||||||||
| 2 | package PONAPI::DAO::Request::RetrieveRelationships; | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 8 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 8 | extends 'PONAPI::DAO::Request'; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 8 | with 'PONAPI::DAO::Request::Role::HasFilter', | |||||||||||||||||||||||||||
| 9 | 'PONAPI::DAO::Request::Role::HasPage', | ||||||||||||||||||||||||||||
| 10 | 'PONAPI::DAO::Request::Role::HasSort', | ||||||||||||||||||||||||||||
| 11 | 'PONAPI::DAO::Request::Role::HasID', | ||||||||||||||||||||||||||||
| 12 | 'PONAPI::DAO::Request::Role::HasRelationshipType'; | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | sub execute { | ||||||||||||||||||||||||||||
| 15 | 16 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
execute: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 16 | ▶ | if ( $self->is_valid ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 18 | 8 | my $repo = $self->repository; | |||||||||||||||||||||||||||
| 19 | 8 | my $document = $self->document; | |||||||||||||||||||||||||||
| 20 | 8 | my $one_to_many = $repo->has_one_to_many_relationship($self->type, $self->rel_type); | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 8 | ▶ | $document->convert_to_collection if $one_to_many; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 8 | $repo->retrieve_relationships( %{ $self } ); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 5 | ▶ | $document->add_null_resource | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$one_to_many or $document->has_resource_builders
MC/DC0%0/2
$one_to_many or $document->has_resource_builders
$one_to_many
$document->has_resource_builders
Truth table66%2/3
A or B
A= $one_to_manyB= $document->has_resource_builders
| |||||||||||||||||||||||||||||
| 27 | unless $one_to_many or $document->has_resource_builders; | ||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 13 | return $self->response(); | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 8 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 34 | 8 | ▶ | no Moose; 1; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | __END__ | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =pod | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =head1 NAME | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | PONAPI::DAO::Request::RetrieveRelationships - DAO request - retrieve relationships | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | =head1 VERSION | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | version 0.002012 | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | =head1 AUTHORS | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | =over 4 | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | =item * | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | Mickey Nasriachi <mickey@cpan.org> | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | =item * | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | Stevan Little <stevan@cpan.org> | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | =item * | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | Brian Fraser <hugmeir@cpan.org> | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | =back | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | This software is copyright (c) 2016 by Mickey Nasriachi, Stevan Little, Brian Fraser. | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 73 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | =cut | ||||||||||||||||||||||||||||