mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
"Closes #3012"
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6249 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
b96a3a2e6f
commit
9c6f44006f
1 changed files with 4 additions and 3 deletions
|
@ -1760,20 +1760,21 @@ class Model extends Overloadable {
|
|||
*
|
||||
* @param array $data Results of find operation
|
||||
* @param string $root NULL or id for root node of operation
|
||||
* @param integer $index last processed index of $data
|
||||
* @return array Threaded results
|
||||
* @access private
|
||||
* @see Model::findAllThreaded()
|
||||
*/
|
||||
function __doThread($data, $root) {
|
||||
function __doThread($data, $root, $index = 0) {
|
||||
$out = array();
|
||||
$sizeOf = sizeof($data);
|
||||
|
||||
for ($ii = 0; $ii < $sizeOf; $ii++) {
|
||||
for ($ii = $index; $ii < $sizeOf; $ii++) {
|
||||
if (($data[$ii][$this->alias]['parent_id'] == $root) || (($root === null) && ($data[$ii][$this->alias]['parent_id'] == '0'))) {
|
||||
$tmp = $data[$ii];
|
||||
|
||||
if (isset($data[$ii][$this->alias][$this->primaryKey])) {
|
||||
$tmp['children'] = $this->__doThread($data, $data[$ii][$this->alias][$this->primaryKey]);
|
||||
$tmp['children'] = $this->__doThread($data, $data[$ii][$this->alias][$this->primaryKey], $ii);
|
||||
} else {
|
||||
$tmp['children'] = null;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue