From 42170dd406a490714b83ab2c329eda7e230a7fb9 Mon Sep 17 00:00:00 2001 From: romanb Date: Thu, 7 Jun 2007 19:17:56 +0000 Subject: [PATCH] Fixed #328 Ticket: 328 --- lib/Doctrine/Tree/NestedSet.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/Tree/NestedSet.php b/lib/Doctrine/Tree/NestedSet.php index 9ace44087..caa1240e3 100644 --- a/lib/Doctrine/Tree/NestedSet.php +++ b/lib/Doctrine/Tree/NestedSet.php @@ -171,12 +171,15 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int public function fetchBranch($pk, $options = array()) { $record = $this->table->find($pk); + if ( ! ($record instanceof Doctrine_Record)) { + // TODO: if record doesn't exist, throw exception or similar? + return false; + } + if ($record->exists()) { $options = array_merge(array('include_record'=>true), $options); return $record->getNode()->traverse('Pre', $options); } - - // TODO: if record doesn't exist, throw exception or similar? } /**