PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_NestedSet » Bug #5160

DB_NestedSet_Output destroy data-array?

Details

Submitted2005-08-20 21:31 UTC
Frommichael at klink dot ws
StatusBogus
PackageDB_NestedSet
PHP Version5.0.3
OSwin xp
Roadmaps(Not assigned)

Comments

[2005-08-20 21:31 UTC] michael at klink dot ws

Description:
------------
The function

$output = DB_NestedSet_Output::factory($values, "Menu");
$data = $output -> returnStructure();

sets the data to 0, theres no structure given back

Test script:
---------------
final public function _show() {
$this -> _sql = new _sql();
$data = $this -> _sql -> _tree();
foreach($data as $id => $sql) {
$data[$id][url] = "http://".$config[root]."/index.php?OSys=".$data[$id][id]."&modul=MYORGANISATION&action=&id=&PHPSESSID=".$_SESSION[session]."";
}
$values = array(
structure => $data,
titleField => "name",
urlField => "url"
);
// hier ist data noch voll
$output = DB_NestedSet_Output::factory($values, "Menu");
$data = $output -> returnStructure();
// hier wird das data-array gelöscht!!!
$menu =& new HTML_Menu($data);
$menu->forceCurrentUrl('/item1.2.2.2.php');
$treeRenderer =& new HTML_Menu_SigmaRenderer($this -> _template, 'BOX_');
$menu->render($treeRenderer, 'tree');
}

Expected result:
----------------
echo var_dump($data);
// hier ist data noch voll

$output = DB_NestedSet_Output::factory($values, "Menu");
$data = $output -> returnStructure();
echo var_dump($data);
// array(0) { }
// hier wird das data-array gelöscht!!!

[2005-10-25 23:51 UTC] datenpunk at php dot net

What do you expect when you do a $var = foo(); and foo returns no result? Why do you use $data twice?
Please have a close look at th Menu_example.php - there's something wrong with your code. The menu driver works.

--
Daniel Khan