[Catalyst-commits] r12293 - in Catalyst-Controller-DBIC-API/1.003: .
branches/moosify-validation-configurability/lib/Catalyst/Controller/DBIC/API
nperez at dev.catalyst.perl.org
nperez at dev.catalyst.perl.org
Thu Dec 10 12:24:28 GMT 2009
Author: nperez
Date: 2009-12-10 12:24:27 +0000 (Thu, 10 Dec 2009)
New Revision: 12293
Modified:
Catalyst-Controller-DBIC-API/1.003/
Catalyst-Controller-DBIC-API/1.003/branches/moosify-validation-configurability/lib/Catalyst/Controller/DBIC/API/Base.pm
Catalyst-Controller-DBIC-API/1.003/branches/moosify-validation-configurability/lib/Catalyst/Controller/DBIC/API/StaticArguments.pm
Log:
r4262 at nicklaptop: nicholas | 2009-12-10 06:23:17 -0600
Make returning the object from create/update configurable
Property changes on: Catalyst-Controller-DBIC-API/1.003
___________________________________________________________________
Name: svk:merge
- 4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Controller-DBIC-API/1.001:9528
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Controller-DBIC-API/1.002:9762
992f488a-d630-404b-95f9-f7d0fdf28443:/local/ccda:4259
+ 4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Controller-DBIC-API/1.001:9528
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Controller-DBIC-API/1.002:9762
992f488a-d630-404b-95f9-f7d0fdf28443:/local/ccda:4262
Modified: Catalyst-Controller-DBIC-API/1.003/branches/moosify-validation-configurability/lib/Catalyst/Controller/DBIC/API/Base.pm
===================================================================
--- Catalyst-Controller-DBIC-API/1.003/branches/moosify-validation-configurability/lib/Catalyst/Controller/DBIC/API/Base.pm 2009-12-10 10:04:30 UTC (rev 12292)
+++ Catalyst-Controller-DBIC-API/1.003/branches/moosify-validation-configurability/lib/Catalyst/Controller/DBIC/API/Base.pm 2009-12-10 12:24:27 UTC (rev 12293)
@@ -251,6 +251,8 @@
my $empty_object = $c->stash->{$self->rs_stash_key}->new_result({});
$c->stash->{created_object} = $self->validate_and_save_object($c, $empty_object);
+ $c->stash->{response}->{$self->data_root} = $c->stash->{created_object}
+ if $self->return_object;
}
sub update :Private {
@@ -267,7 +269,10 @@
}
my $object = $c->stash->{$self->object_stash_key};
- $self->validate_and_save_object($c, $object);
+ $object = $self->validate_and_save_object($c, $object);
+ $c->stash->{response}->{$self->data_root} = $object
+ if $self->return_object;
+
}
sub delete :Private {
@@ -355,7 +360,8 @@
eval {
if ($object->in_storage) {
foreach my $key (keys %{$params}) {
- if (ref $params->{$key}) {
+ my $value = $params->{$key};
+ if (ref($value) && !($value == JSON::Any::true || $value == JSON::Any::false)) {
my $related_params = delete $params->{$key};
my $row = $object->find_related($key, {} , {});
$row->update($related_params);
Modified: Catalyst-Controller-DBIC-API/1.003/branches/moosify-validation-configurability/lib/Catalyst/Controller/DBIC/API/StaticArguments.pm
===================================================================
--- Catalyst-Controller-DBIC-API/1.003/branches/moosify-validation-configurability/lib/Catalyst/Controller/DBIC/API/StaticArguments.pm 2009-12-10 10:04:30 UTC (rev 12292)
+++ Catalyst-Controller-DBIC-API/1.003/branches/moosify-validation-configurability/lib/Catalyst/Controller/DBIC/API/StaticArguments.pm 2009-12-10 12:24:27 UTC (rev 12293)
@@ -42,5 +42,6 @@
has 'prefetch_arg' => ( is => 'ro', isa => Str, default => 'list_prefetch' );
has 'data_root' => ( is => 'ro', isa => Str, default => 'list');
has 'use_json_boolean' => ( is => 'ro', isa => Bool, default => 0 );
+has 'return_object' => ( is => 'ro', isa => Bool, default => 0 );
1;
More information about the Catalyst-commits
mailing list