[Catalyst-commits] r8316 - in
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk: .
lib/CatalystX/CRUD/Model
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Fri Aug 29 16:12:58 BST 2008
Author: karpet
Date: 2008-08-29 16:12:58 +0100 (Fri, 29 Aug 2008)
New Revision: 8316
Modified:
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm
Log:
fix _related() method query maker
Modified: CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes 2008-08-28 18:53:58 UTC (rev 8315)
+++ CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes 2008-08-29 15:12:58 UTC (rev 8316)
@@ -50,5 +50,6 @@
* move column sort disambiguation from CatalystX::CRUD::YUI::Controller to here.
* support for 0.30 core api param name change
* add 'int' to column types registered as 'treat_like_int'
+ * fix query for _related methods.
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-28 18:53:58 UTC (rev 8315)
+++ CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm 2008-08-29 15:12:58 UTC (rev 8316)
@@ -272,21 +272,33 @@
=cut
+sub _related_query {
+ my ($self) = @_;
+ my $query = $self->make_query;
+ my @arg;
+ for (qw( limit offset sort_by )) {
+ if ( exists $query->{$_} and length $query->{$_} ) {
+ push( @arg, $_ => $query->{$_} );
+ }
+ }
+ return @arg;
+}
+
sub search_related {
my ( $self, $obj, $rel ) = @_;
- return $obj->$rel;
+ return $obj->$rel( $self->_related_query );
}
sub iterator_related {
my ( $self, $obj, $rel ) = @_;
my $method = $rel . '_iterator';
- return $obj->$method;
+ return $obj->$method( $self->_related_query );
}
sub count_related {
my ( $self, $obj, $rel ) = @_;
my $method = $rel . '_count';
- return $obj->$method;
+ return $obj->$method( $self->_related_query );
}
=head2 add_related( I<obj>, I<rel_name>, I<foreign_value> )
More information about the Catalyst-commits
mailing list