• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/internals/task/projectdependence.php
  • Класс: BitrixTasksInternalsTaskProjectDependenceTable
  • Вызов: ProjectDependenceTable::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);
}