• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/internals/database/structure/closuretree/fragment.php
  • Класс: BitrixTasksInternalsDataBaseStructureClosureTreeFragment
  • Вызов: Fragment::walkDepthStep
private function walkDepthStep($id, $parentId, $cb, array $index, Result $result, array &$data, array &$met, $depth = 1)
{
	if($depth > 10000)
	{
		$result->addError('ILLEGAL_STRUCTURE.DEPTH', 'Illegal fragment structure');
		return;
	}

	if(isset($met[$id]))
	{
		return; // do not go the same way twice
	}
	$met[$id] = true;

	if(array_key_exists($id, $index))
	{
		foreach($index[$id] as $nextId)
		{
			$this->walkDepthStep($nextId, $id, $cb, $index, $result, $data, $met, $depth + 1);
		}
	}

	if($id)
	{
		$data[$id] = call_user_func_array(
			$cb,
			array(
				null/** todo: object will be here some day, on which we can do ->getParentId() or even ->getParent() */,
				$id,
				$this->values[$id],
				$parentId
			)
		);
	}
}