[Catalyst-commits] r8230 - in
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk: .
lib/CatalystX/CRUD/ModelAdapter
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Mon Aug 18 05:23:58 BST 2008
Author: karpet
Date: 2008-08-18 05:23:58 +0100 (Mon, 18 Aug 2008)
New Revision: 8230
Modified:
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/Changes
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/lib/CatalystX/CRUD/ModelAdapter/DBIC.pm
Log:
refactor make_query()
Modified: CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/Changes
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/Changes 2008-08-17 16:30:30 UTC (rev 8229)
+++ CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/Changes 2008-08-18 04:23:58 UTC (rev 8230)
@@ -7,4 +7,9 @@
* fix bug in order of params to make_query()
* add example app in t/example/MyApp
+0.03 xxx
+ * fix make_query() to return hash ref like
+ other Models do.
+
+
Modified: CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/lib/CatalystX/CRUD/ModelAdapter/DBIC.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/lib/CatalystX/CRUD/ModelAdapter/DBIC.pm 2008-08-17 16:30:30 UTC (rev 8229)
+++ CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/lib/CatalystX/CRUD/ModelAdapter/DBIC.pm 2008-08-18 04:23:58 UTC (rev 8230)
@@ -5,7 +5,7 @@
use Class::C3;
use Scalar::Util qw( weaken );
-our $VERSION = '0.02';
+our $VERSION = '0.03';
=head1 NAME
@@ -95,10 +95,11 @@
sub search {
my ( $self, $controller, $c, @arg ) = @_;
my $query = shift(@arg) || $self->make_query( $controller, $c );
- my @rs
- = $c->model( $self->model_name )
- ->resultset( $self->_get_moniker( $controller, $c ) )
- ->search(@$query);
+ my @q = ( $query->{query} );
+ push( @q, $controller->model_meta->{resultset_opts} )
+ if $controller->model_meta->{resultset_opts};
+ my @rs = $c->model( $self->model_name )
+ ->resultset( $self->_get_moniker( $controller, $c ) )->search(@q);
return wantarray ? @rs : \@rs;
}
@@ -121,10 +122,11 @@
sub iterator {
my ( $self, $controller, $c, @arg ) = @_;
my $query = shift(@arg) || $self->make_query( $controller, $c );
- my $rs
- = $c->model( $self->model_name )
- ->resultset( $self->_get_moniker( $controller, $c ) )
- ->search(@$query);
+ my @q = ( $query->{query} );
+ push( @q, $controller->model_meta->{resultset_opts} )
+ if $controller->model_meta->{resultset_opts};
+ my $rs = $c->model( $self->model_name )
+ ->resultset( $self->_get_moniker( $controller, $c ) )->search(@q);
return $rs;
}
@@ -137,8 +139,11 @@
sub count {
my ( $self, $controller, $c, @arg ) = @_;
my $query = shift(@arg) || $self->make_query( $controller, $c );
+ my @q = ( $query->{query} );
+ push( @q, $controller->model_meta->{resultset_opts} )
+ if $controller->model_meta->{resultset_opts};
return $c->model( $self->model_name )
- ->resultset( $self->_get_moniker( $controller, $c ) )->count(@$query);
+ ->resultset( $self->_get_moniker( $controller, $c ) )->count(@q);
}
=head2 make_query( I<controller>, I<context>, I<field_names> )
@@ -162,15 +167,7 @@
$self->{context} = $c;
weaken( $self->{context} );
- my @query;
- my $q = $self->make_sql_query($field_names) || {};
-
- push( @query,
- { @{ $q->{query} || [] } },
- $controller->model_meta->{resultset_opts} )
- if $controller->model_meta->{resultset_opts};
-
- return \@query;
+ return $self->make_sql_query($field_names) || {};
}
sub _get_field_names {
More information about the Catalyst-commits
mailing list