Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.3.7

Request #11982 Root node not present in SQL Query
Submitted: 2007-09-05 10:58 UTC
From: therebel22 Assigned:
Status: Open Package: Tree (version 0.3.2)
PHP Version: 5.2.3 OS: Linux Debian Etch
Roadmaps: (Not assigned)    
Subscription  


 [2007-09-05 10:58 UTC] therebel22 (Marc France)
Description: ------------ Hi, juste an improvment if you want in MemoryDbSimple : I hav done a query with some rows with fatherId = -1. But in the dataset returned, there wasn't any row with id = 1. So, my idea is to create a virtual row with missing id : Here line 268 in Memory.php : /// Searching for missing parentId if present unset($tmpAryId); unset($tmpAryParentId); foreach($res as $tmp_id => $tmp_val) { $tmpAryId[] = $tmp_val['id']; $tmpAryParentId[] = $tmp_val['parentId']; } foreach($tmpAryParentId as $tmp_val) { if(!in_array($tmp_val,$tmpAryId)) $res[] = array ( 'id' => $tmp_val , 'parentId' => 0 ,'name' => 'root'); } Bye

Comments