[Bast-commits] r4631 - DBIx-Class-Tree-NestedSet/lib/DBIx/Class/Tree
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Fri Jul 25 01:43:56 BST 2008
Author: rafl
Date: 2008-07-25 01:43:56 +0100 (Fri, 25 Jul 2008)
New Revision: 4631
Modified:
DBIx-Class-Tree-NestedSet/lib/DBIx/Class/Tree/NestedSet.pm
Log:
Also limit searches on related parents to the right row.
Modified: DBIx-Class-Tree-NestedSet/lib/DBIx/Class/Tree/NestedSet.pm
===================================================================
--- DBIx-Class-Tree-NestedSet/lib/DBIx/Class/Tree/NestedSet.pm 2008-07-25 00:43:50 UTC (rev 4630)
+++ DBIx-Class-Tree-NestedSet/lib/DBIx/Class/Tree/NestedSet.pm 2008-07-25 00:43:56 UTC (rev 4631)
@@ -107,13 +107,15 @@
sub search_related {
my ($self, $rel, $cond, @rest) = @_;
+ my $pk = ($self->result_source->primary_columns)[0];
+ $cond ||= {};
if ($rel eq 'children') {
- my $pk = ($self->result_source->primary_columns)[0];
-
- $cond ||= {};
$cond->{"parent.$pk"} = $self->$pk,
}
+ elsif ($rel eq 'parents') {
+ $cond->{"child.$pk"} = $self->$pk,
+ }
return $self->next::method($rel, $cond, @rest);
}
More information about the Bast-commits
mailing list