X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Controller-DBIC-API.git;a=blobdiff_plain;f=lib%2FCatalyst%2FController%2FDBIC%2FAPI.pm;h=ef19f08f52a232e34d7667a2927a3e366400077c;hp=ad36164b6f1d6e982955e658c7b4c1c6ae413d95;hb=609916e5de6201b2e2212328153657194b41a730;hpb=8cf0b66a04e74b7bd5db0c8041575825ec8f73d2 diff --git a/lib/Catalyst/Controller/DBIC/API.pm b/lib/Catalyst/Controller/DBIC/API.pm index ad36164..ef19f08 100644 --- a/lib/Catalyst/Controller/DBIC/API.pm +++ b/lib/Catalyst/Controller/DBIC/API.pm @@ -421,6 +421,31 @@ sub row_format_output return $row; # passthrough by default } +=method_protected item + + :Private + +item will return a single object called by identifier in the uri. It will be inflated via each_object_inflate. + +=cut + +sub item :Private +{ + my ($self, $c) = @_; + + if($c->req->count_objects != 1) + { + $c->log->error($_); + $self->push_error($c, { message => 'No objects on which to operate' }); + $c->detach(); + } + else + { + $c->stash->{response}->{$self->item_root} = $self->each_object_inflate($c, $c->req->get_object(0)); + } +} + + =method_protected update_or_create :Private