• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/task/dependence.php
  • Класс: Bitrix\Tasks\Task\does
  • Вызов: does::checkLinkExists
static function checkLinkExists($id, $parentId, array $parameters = array('BIDIRECTIONAL' => false))
{
	$parentColName = static::getPARENTIDColumnName();
	$idColName = static::getIDColumnName();
	//$directColName = static::getDIRECTColumnName();

	$id = intval($id);
	$parentId = intval($parentId);
	if(!$id || !$parentId)
	{
		return false; // link to non-existed nodes does not exist
	}

	$item = HttpApplication::getConnection()->query("
		select ".$idColName." 
			from 
				".static::getTableName()." 
			where 
				(
					".$idColName." = '".$id."' 
					and ".$parentColName." = '".$parentId."' 
				)
				".($parameters['BIDIRECTIONAL'] ? "

				or
				(
					".$idColName." = '".$parentId."' 
					and ".$parentColName." = '".$id."' 
				)

				" : "")."
		")->fetch();

	return is_array($item);
}