projects
/
dbsrgits/DBIx-Class-Tree.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
optimized is_leaf to not trigger another query if the children releationship is prefe...
[dbsrgits/DBIx-Class-Tree.git]
/
lib
/
DBIx
/
Class
/
Tree
/
AdjacencyList.pm
diff --git
a/lib/DBIx/Class/Tree/AdjacencyList.pm
b/lib/DBIx/Class/Tree/AdjacencyList.pm
index
e668a38
..
e14875f
100644
(file)
--- a/
lib/DBIx/Class/Tree/AdjacencyList.pm
+++ b/
lib/DBIx/Class/Tree/AdjacencyList.pm
@@
-309,10
+309,7
@@
Returns 1 if the object has no children, and 0 otherwise.
sub is_leaf {
my( $self ) = @_;
- my $has_child = $self->result_source->resultset->search(
- { $self->_parent_column => $self->id() },
- { limit => 1 }
- )->count();
+ my $has_child = $self->children_rs->count();
return $has_child ? 0 : 1;
}