[Catalyst-commits] r14517 - in CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk: . lib/CatalystX/CRUD/Model lib/CatalystX/CRUD/Object
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Sat May 10 20:20:55 GMT 2014
Author: karpet
Date: 2014-05-10 20:20:54 +0000 (Sat, 10 May 2014)
New Revision: 14517
Modified:
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Object/RDBO.pm
Log:
avoid sort-by-PK on related objects (ref r14454)
Modified: CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes 2014-04-24 14:13:55 UTC (rev 14516)
+++ CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes 2014-05-10 20:20:54 UTC (rev 14517)
@@ -1,5 +1,9 @@
Revision history for CatalystX-CRUD-Model-RDBO
+0.301 xxx
+ - skip related sort_by unless explicitly passed in cxc-* params
+ (fix for 0.29 r14454)
+
0.30 28 Feb 2014
- support for CXC 0.56
Modified: CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm 2014-04-24 14:13:55 UTC (rev 14516)
+++ CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm 2014-05-10 20:20:54 UTC (rev 14517)
@@ -8,7 +8,7 @@
use Carp;
use Data::Dump qw( dump );
-our $VERSION = '0.30';
+our $VERSION = '0.301';
__PACKAGE__->mk_ro_accessors(
qw( name manager treat_like_int load_with related_load_with ));
@@ -305,9 +305,24 @@
@arg = ( query => $query->{query} );
}
for (qw( limit offset sort_by )) {
- if ( $self->context->req->params->{'cxc-m2m'} and $_ eq 'sort_by' ) {
- next;
+
+ # only want to include the sort_by if it makes sense.
+ if ( $_ eq 'sort_by' ) {
+
+ # can't reliably predict table prefixes in a m2m
+ if ( $self->context->req->params->{'cxc-m2m'} ) {
+ next;
+ }
+
+ # if sort_by was derived from PK, it may refer to a parent table,
+ # not the related table. So skip it unless it was explicit.
+ if ( !$self->context->req->params->{'cxc-order'}
+ and !$self->context->req->params->{'cxc-sort'} )
+ {
+ next;
+ }
}
+
if ( exists $query->{$_} and length $query->{$_} ) {
push( @arg, $_ => $query->{$_} );
}
Modified: CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Object/RDBO.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Object/RDBO.pm 2014-04-24 14:13:55 UTC (rev 14516)
+++ CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Object/RDBO.pm 2014-05-10 20:20:54 UTC (rev 14517)
@@ -7,7 +7,7 @@
use Rose::DB::Object::Helpers qw( column_values_as_json );
use JSON;
-our $VERSION = '0.30';
+our $VERSION = '0.301';
=head1 NAME
More information about the Catalyst-commits
mailing list