← Index
NYTProf Performance Profile   « line view »
For script/ponapi
  Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:11 2016

Filename/home/mickey/git_tree/PONAPI/Server/lib/PONAPI/DAO/Request/CreateRelationships.pm
StatementsExecuted 8 statements in 315µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11120µs3.19msPONAPI::DAO::Request::CreateRelationships::::BEGIN@4PONAPI::DAO::Request::CreateRelationships::BEGIN@4
11110µs81µsPONAPI::DAO::Request::CreateRelationships::::BEGIN@46PONAPI::DAO::Request::CreateRelationships::BEGIN@46
0000s0sPONAPI::DAO::Request::CreateRelationships::::_validate_rel_typePONAPI::DAO::Request::CreateRelationships::_validate_rel_type
0000s0sPONAPI::DAO::Request::CreateRelationships::::check_data_type_matchPONAPI::DAO::Request::CreateRelationships::check_data_type_match
0000s0sPONAPI::DAO::Request::CreateRelationships::::executePONAPI::DAO::Request::CreateRelationships::execute
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# ABSTRACT: DAO request - create relationships
2package PONAPI::DAO::Request::CreateRelationships;
3
42246µs26.35ms
# spent 3.19ms (20µs+3.17) within PONAPI::DAO::Request::CreateRelationships::BEGIN@4 which was called: # once (20µs+3.17ms) by PONAPI::DAO::BEGIN@11 at line 4
use Moose;
# spent 3.19ms making 1 call to PONAPI::DAO::Request::CreateRelationships::BEGIN@4 # spent 3.17ms making 1 call to Moose::import
5
612µs1646µsextends 'PONAPI::DAO::Request';
# spent 646µs making 1 call to Moose::extends
7
814µs149.6mswith 'PONAPI::DAO::Request::Role::UpdateLike',
# spent 49.6ms 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
14sub check_data_type_match { 1 } # to avoid code duplications in HasDataMethods
15
16sub execute {
17 my $self = shift;
18
19 if ( $self->is_valid ) {
20 my @ret = $self->repository->create_relationships( %{ $self } );
21 $self->_add_success_meta(@ret)
22 if $self->_verify_update_response(@ret);
23 }
24
25 return $self->response();
26}
27
28sub _validate_rel_type {
29 my ( $self, $args ) = @_;
30
31 return $self->_bad_request( "`relationship type` is missing for this request" )
32 unless $self->has_rel_type;
33
34 my $type = $self->type;
35 my $rel_type = $self->rel_type;
36
37 return $self->_bad_request( "Types `$type` and `$rel_type` are not related", 404 )
38 unless $self->repository->has_relationship( $type, $rel_type );
39
40 return $self->_bad_request( "Types `$type` and `$rel_type` are one-to-one" )
41 unless $self->repository->has_one_to_many_relationship( $type, $rel_type );
42}
43
44
4514µs210.7ms__PACKAGE__->meta->make_immutable;
# spent 10.7ms making 1 call to Class::MOP::Class::make_immutable # spent 14µs making 1 call to PONAPI::DAO::Request::CreateRelationships::meta
46360µs2153µs
# spent 81µs (10+72) within PONAPI::DAO::Request::CreateRelationships::BEGIN@46 which was called: # once (10µs+72µs) by PONAPI::DAO::BEGIN@11 at line 46
no Moose; 1;
# spent 81µs making 1 call to PONAPI::DAO::Request::CreateRelationships::BEGIN@46 # spent 72µs making 1 call to Moose::unimport
47
48__END__