• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/checklist/internals/checklisttree.php
  • Класс: BitrixTasksCheckListInternalsCheckListTree
  • Вызов: CheckListTree::isPathExist
static function isPathExist($parentId, $id, array $parameters = [])
{
	$id = (int)$id;
	$parentId = (int)$parentId;

	// no path fromto nowhere
	if (!$id || !$parentId)
	{
		return false;
	}

	/** @var DataManager $dataController */
	$dataController = static::getDataController();
	$parentColumnName = static::getParentNodeColumnName();
	$childColumnName = static::getNodeColumnName();
	$levelColumnName = static::getLevelColumnName();

	$filter = [
		$parentColumnName => $parentId,
		$childColumnName => $id
	];

	if ($parameters['DIRECT'] ?? null)
	{
		$filter[$levelColumnName] = 1;
	}

	if ($parameters['BOTH_DIRECTIONS'] ?? null)
	{
		$filter = [
			'LOGIC' => 'OR',
			$filter,
			[
				$parentColumnName => $id,
				$childColumnName => $parentId
			]
		];
	}

	$item = $dataController::getList([
		'select' => ['PARENT_ID'],
		'filter' => $filter
	])->fetch();

	return (bool)$item;
}