From: Aran Deltac Date: Thu, 23 Mar 2006 17:52:51 +0000 (+0000) Subject: No more $self->search in Positioned. X-Git-Tag: v0.07002~75^2~276 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a9cdbec2cca26980bcea54af932666af9936d189;p=dbsrgits%2FDBIx-Class.git No more $self->search in Positioned. --- diff --git a/lib/DBIx/Class/Positioned.pm b/lib/DBIx/Class/Positioned.pm index b9370b2..d3b7cf7 100644 --- a/lib/DBIx/Class/Positioned.pm +++ b/lib/DBIx/Class/Positioned.pm @@ -100,7 +100,7 @@ excluding the one you called it on. sub siblings { my( $self ) = @_; my $position_column = $self->position_column; - my $rs = $self->search( + my $rs = $self->result_source->resultset->search( { $position_column => { '!=' => $self->get_column($position_column) }, $self->_collection_clause(), @@ -121,9 +121,11 @@ Returns the first sibling object. sub first_sibling { my( $self ) = @_; - return ($self->search( - { $self->_collection_clause() }, - { rows=>1, order_by => $self->position_column }, + return ($self->result_source->resultset->search( + { + $self->position_column => 1, + $self->_collection_clause(), + }, )->all())[0]; } @@ -137,9 +139,12 @@ Return the last sibling. sub last_sibling { my( $self ) = @_; - return ($self->search( - { $self->_collection_clause() }, - { rows=>1, order_by => $self->position_column.' DESC' }, + my $count = $self->result_source->resultset->search({$self->_collection_clause()})->count(); + return ($self->result_source->resultset->search( + { + $self->position_column => $count, + $self->_collection_clause(), + }, )->all())[0]; }