[Catalyst-commits] r8302 - 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
Wed Aug 27 04:39:35 BST 2008
Author: karpet
Date: 2008-08-27 04:39:35 +0100 (Wed, 27 Aug 2008)
New Revision: 8302
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:
move some YUI code in here
Modified: CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes 2008-08-27 03:37:05 UTC (rev 8301)
+++ CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes 2008-08-27 03:39:35 UTC (rev 8302)
@@ -48,4 +48,7 @@
0.14 25 Aug 2008
* fix add_related() to forget_related() after save, so that next access reflects the addition.
+0.15 xxx
+ * move column sort disambiguation from CatalystX::CRUD::YUI::Controller to here.
+
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 2008-08-27 03:37:05 UTC (rev 8301)
+++ CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm 2008-08-27 03:39:35 UTC (rev 8302)
@@ -7,7 +7,7 @@
use Carp;
use Data::Dump qw( dump );
-our $VERSION = '0.14';
+our $VERSION = '0.15';
__PACKAGE__->mk_ro_accessors(qw( name manager treat_like_int ));
__PACKAGE__->config( object_class => 'CatalystX::CRUD::Object::RDBO' );
@@ -429,9 +429,18 @@
my $field_names = shift || $self->_get_field_names;
my $q = $self->make_sql_query($field_names);
- # dis-ambiguate common column names
- $q->{sort_by} =~ s,\bname\ ,t1.name ,;
- $q->{sort_by} =~ s,\bid\ ,t1.id ,;
+ # many2many relationships always have two tables,
+ # and we are sorting my the 2nd one. The 1st one is the mapper.
+ if ( $c->req->params->{_m2m} ) {
+ unless ( $q->{sort_by} =~ m/t\d\./ ) {
+ $q->{sort_by} = join( '.', 't2', $q->{sort_by} );
+ }
+ }
+ else {
+ unless ( $q->{sort_by} =~ m/t\d\./ ) {
+ $q->{sort_by} = join( '.', 't1', $q->{sort_by} );
+ }
+ }
return $q;
}
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 2008-08-27 03:37:05 UTC (rev 8301)
+++ CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Object/RDBO.pm 2008-08-27 03:39:35 UTC (rev 8302)
@@ -3,7 +3,7 @@
use warnings;
use base qw( CatalystX::CRUD::Object );
-our $VERSION = '0.14';
+our $VERSION = '0.15';
=head1 NAME
More information about the Catalyst-commits
mailing list