| Filename | /home/mickey/git_tree/PONAPI/Server/lib/PONAPI/DAO/Request/DeleteRelationships.pm |
| Statements | Executed 8 statements in 321µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 18µs | 3.18ms | PONAPI::DAO::Request::DeleteRelationships::BEGIN@4 |
| 1 | 1 | 1 | 9µs | 93µs | PONAPI::DAO::Request::DeleteRelationships::BEGIN@47 |
| 0 | 0 | 0 | 0s | 0s | PONAPI::DAO::Request::DeleteRelationships::_validate_rel_type |
| 0 | 0 | 0 | 0s | 0s | PONAPI::DAO::Request::DeleteRelationships::check_data_type_match |
| 0 | 0 | 0 | 0s | 0s | PONAPI::DAO::Request::DeleteRelationships::execute |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | # ABSTRACT: DAO request - delete relationships | ||||
| 2 | package PONAPI::DAO::Request::DeleteRelationships; | ||||
| 3 | |||||
| 4 | 2 | 251µs | 2 | 6.34ms | # spent 3.18ms (18µs+3.16) within PONAPI::DAO::Request::DeleteRelationships::BEGIN@4 which was called:
# once (18µs+3.16ms) by PONAPI::DAO::BEGIN@15 at line 4 # spent 3.18ms making 1 call to PONAPI::DAO::Request::DeleteRelationships::BEGIN@4
# spent 3.16ms making 1 call to Moose::import |
| 5 | |||||
| 6 | 1 | 14µs | 1 | 628µs | extends 'PONAPI::DAO::Request'; # spent 628µs making 1 call to Moose::extends |
| 7 | |||||
| 8 | 1 | 4µs | 1 | 22.2ms | with 'PONAPI::DAO::Request::Role::UpdateLike', # spent 22.2ms making 1 call to Moose::with |
| 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 | sub check_data_type_match { 1 } # to avoid code duplications in HasDataMethods | ||||
| 15 | |||||
| 16 | sub execute { | ||||
| 17 | my $self = shift; | ||||
| 18 | |||||
| 19 | if ( $self->is_valid ) { | ||||
| 20 | my @ret = $self->repository->delete_relationships( %{ $self } ); | ||||
| 21 | |||||
| 22 | $self->_add_success_meta(@ret) | ||||
| 23 | if $self->_verify_update_response(@ret); | ||||
| 24 | } | ||||
| 25 | |||||
| 26 | return $self->response(); | ||||
| 27 | } | ||||
| 28 | |||||
| 29 | sub _validate_rel_type { | ||||
| 30 | my ( $self, $args ) = @_; | ||||
| 31 | |||||
| 32 | return $self->_bad_request( "`relationship type` is missing for this request" ) | ||||
| 33 | unless $self->has_rel_type; | ||||
| 34 | |||||
| 35 | my $type = $self->type; | ||||
| 36 | my $rel_type = $self->rel_type; | ||||
| 37 | |||||
| 38 | return $self->_bad_request( "Types `$type` and `$rel_type` are not related", 404 ) | ||||
| 39 | unless $self->repository->has_relationship( $type, $rel_type ); | ||||
| 40 | |||||
| 41 | return $self->_bad_request( "Types `$type` and `$rel_type` are one-to-one" ) | ||||
| 42 | unless $self->repository->has_one_to_many_relationship( $type, $rel_type ); | ||||
| 43 | } | ||||
| 44 | |||||
| 45 | |||||
| 46 | 1 | 4µs | 2 | 9.97ms | __PACKAGE__->meta->make_immutable; # spent 9.95ms making 1 call to Class::MOP::Class::make_immutable
# spent 22µs making 1 call to PONAPI::DAO::Request::DeleteRelationships::meta |
| 47 | 3 | 48µs | 2 | 177µs | # spent 93µs (9+84) within PONAPI::DAO::Request::DeleteRelationships::BEGIN@47 which was called:
# once (9µs+84µs) by PONAPI::DAO::BEGIN@15 at line 47 # spent 93µs making 1 call to PONAPI::DAO::Request::DeleteRelationships::BEGIN@47
# spent 84µs making 1 call to Moose::unimport |
| 48 | |||||
| 49 | __END__ |