| 1 | # ABSTRACT: DAO request - delete relationships | ||||||||||
| 2 | package PONAPI::DAO::Request::DeleteRelationships; | ||||||||||
| 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::UpdateLike', | |||||||||
| 9 | 'PONAPI::DAO::Request::Role::HasDataBulk', | ||||||||||
| 10 | 'PONAPI::DAO::Request::Role::HasDataMethods', | ||||||||||
| 11 | 'PONAPI::DAO::Request::Role::HasID', | ||||||||||
| 12 | 'PONAPI::DAO::Request::Role::HasRelationshipType'; | ||||||||||
| 13 | |||||||||||
| 14 | 14 | ▶ | sub check_data_type_match { 1 } # to avoid code duplications in HasDataMethods | ||||||||
|
Subroutine
check_data_type_match: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 15 | |||||||||||
| 16 | sub execute { | ||||||||||
| 17 | 15 | ▶ | my $self = shift; | ||||||||
|
Subroutine
execute: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 18 | |||||||||||
| 19 | 15 | ▶ | if ( $self->is_valid ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 9 | my @ret = $self->repository->delete_relationships( %{ $self } ); | |||||||||
| 21 | |||||||||||
| 22 | 6 | ▶ | $self->_add_success_meta(@ret) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | if $self->_verify_update_response(@ret); | ||||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 11 | return $self->response(); | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | sub _validate_rel_type { | ||||||||||
| 30 | 14 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_validate_rel_type: called CC=2 SCAR=6.9
| |||||||||||
| 31 | 14 | my $type = $self->type; | |||||||||
| 32 | 14 | my $rel_type = $self->rel_type; | |||||||||
| 33 | |||||||||||
| 34 | 14 | super(@_); | |||||||||
| 35 | |||||||||||
| 36 | 14 | ▶ | if ( !$self->repository->has_one_to_many_relationship( $type, $rel_type ) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 1 | $self->_bad_request( "Types `$type` and `$rel_type` are one-to-one" ); | |||||||||
| 38 | } | ||||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | |||||||||||
| 42 | 8 | __PACKAGE__->meta->make_immutable; | |||||||||
| 43 | 8 | ▶ | no Moose; 1; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 44 | |||||||||||
| 45 | __END__ | ||||||||||
| 46 | |||||||||||
| 47 | =pod | ||||||||||
| 48 | |||||||||||
| 49 | =encoding UTF-8 | ||||||||||
| 50 | |||||||||||
| 51 | =head1 NAME | ||||||||||
| 52 | |||||||||||
| 53 | PONAPI::DAO::Request::DeleteRelationships - DAO request - delete relationships | ||||||||||
| 54 | |||||||||||
| 55 | =head1 VERSION | ||||||||||
| 56 | |||||||||||
| 57 | version 0.002012 | ||||||||||
| 58 | |||||||||||
| 59 | =head1 AUTHORS | ||||||||||
| 60 | |||||||||||
| 61 | =over 4 | ||||||||||
| 62 | |||||||||||
| 63 | =item * | ||||||||||
| 64 | |||||||||||
| 65 | Mickey Nasriachi <mickey@cpan.org> | ||||||||||
| 66 | |||||||||||
| 67 | =item * | ||||||||||
| 68 | |||||||||||
| 69 | Stevan Little <stevan@cpan.org> | ||||||||||
| 70 | |||||||||||
| 71 | =item * | ||||||||||
| 72 | |||||||||||
| 73 | Brian Fraser <hugmeir@cpan.org> | ||||||||||
| 74 | |||||||||||
| 75 | =back | ||||||||||
| 76 | |||||||||||
| 77 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 78 | |||||||||||
| 79 | This software is copyright (c) 2016 by Mickey Nasriachi, Stevan Little, Brian Fraser. | ||||||||||
| 80 | |||||||||||
| 81 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 82 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 83 | |||||||||||
| 84 | =cut | ||||||||||