• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/internals/database/structure/closuretree.php
  • Класс: BitrixTasksInternalsDataBaseStructureClosureTree
  • Вызов: ClosureTree::isPathExist
static function isPathExist($parentId, $id, array $settings = array())
{
	$id = intval($id);
	$parentId = intval($parentId);

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

	$pCName = static::getParentNodeColumnName();
	$cName = static::getNodeColumnName();
	$tableName = static::getTableName();

	$connection = MainHttpApplication::getConnection();

	$res = $connection->query("
		select 1
		from
			".$tableName."
		where

		(
		 ".$pCName." = ".intval($parentId)."
		 and
		 ".$cName." = ".intval($id)."

		 ".(($settings['DIRECT'] ?? null) ? "

		    and DIRECT = '1'

		 " : "")."
		)
		".(($settings['BOTH_DIRECTIONS'] ?? null) ? "

		or
		(
		 ".$cName." = ".intval($parentId)."
		 and
		 ".$pCName." = ".intval($id)."
		)

		" : "")."

	")->fetch();

	return !!$res;
}