Skip to content

Commit

Permalink
buildDataTree(): Minor improvment.
Browse files Browse the repository at this point in the history
  • Loading branch information
arnemorken committed Nov 19, 2024
1 parent e96e422 commit 57e9878
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions data/mysql/anyTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -1712,27 +1712,25 @@ protected function buildDataTree(&$flatdata,$parentId=null)
$pid = $subdata["parent_id"];
unset($subdata["parent_id"]);
}
if (is_array($subdata)) {
if (!isset($subdata["parent_id"]) || $subdata["parent_id"] == "")
$subdata["parent_id"] = null;
if ($subdata["parent_id"] == $parentId) {
$children = null;
if (isset($subdata[$id_name]) && $subdata[$id_name] != "")
$children = $this->buildDataTree($flatdata,$subdata[$id_name]);
if ($this->mRecurseDepth > $this->mLastNumRows + $this->mRecurseMax)
break; // Break recursion
if ($children)
$subdata["data"] = $children;
if ($parent_not_in_group && ($pid || $pid === 0))
$subdata["parent_id"] = $pid;
$retval[$idx] = $subdata;
unset($subdata);
} // if subdata
else {
if ($pid != null)
$subdata["parent_id"] = $pid;
}
} // if is_array
if (!isset($subdata["parent_id"]) || $subdata["parent_id"] == "")
$subdata["parent_id"] = null;
if ($subdata["parent_id"] == $parentId && is_array($subdata)) {
$children = null;
if (isset($subdata[$id_name]) && $subdata[$id_name] != "")
$children = $this->buildDataTree($flatdata,$subdata[$id_name]);
if ($this->mRecurseDepth > $this->mLastNumRows + $this->mRecurseMax)
break; // Break recursion
if ($children)
$subdata["data"] = $children;
if ($parent_not_in_group && ($pid || $pid === 0))
$subdata["parent_id"] = $pid;
$retval[$idx] = $subdata;
unset($subdata);
} // if subdata
else {
if ($pid != null)
$subdata["parent_id"] = $pid;
}
} // if isset
} // foreach
return $retval;
Expand Down

0 comments on commit 57e9878

Please sign in to comment.