• Модуль: learning
  • Путь к файлу: ~/bitrix/modules/learning/classes/general/ilearngraphrelation.php
  • Класс: CLearnGraphRelation
  • Вызов: CLearnGraphRelation::Unlink
static function Unlink ($parentNodeId, $childNodeId)
{
	global $DB;

	// reset static cache
	self::$arNodesCache = array();
	self::$nodesCached = 0;

	$args_check = ($parentNodeId > 0) && ($childNodeId > 0);

	if ( ! $args_check )
		throw new LearnException ('EA_PARAMS', LearnException::EXC_ERR_GR_UNLINK);

	$parentNodeId += 0;
	$childNodeId  += 0;

	// Remove graph edge
	$rc = $DB->Query (
		"DELETE FROM b_learn_lesson_edges
		WHERE SOURCE_NODE = '" . $parentNodeId . "'
			AND TARGET_NODE = '" . $childNodeId . "'",
		$ignore_errors = true);

	if ($rc === false)
		throw new LearnException ('EA_SQLERROR', LearnException::EXC_ERR_GR_UNLINK);

	if ($rc->AffectedRowsCount() == 0)
		throw new LearnException ('EA_NOT_EXISTS', LearnException::EXC_ERR_GR_UNLINK);
}