• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/eventmanager.php
  • Класс: BitrixMainEventManager
  • Вызов: EventManager::registerEventHandlerInternal
protected function registerEventHandlerInternal($fromModuleId, $eventType, $toModuleId, $toClass, $toMethod, $sort, $toPath, $toMethodArg, $version)
{
	$toMethodArg = (!is_array($toMethodArg) || empty($toMethodArg) ? '' : serialize($toMethodArg));
	$sort = intval($sort);
	$version = intval($version);

	$uniqueID = md5(mb_strtolower($fromModuleId.'.'.$eventType.'.'.$toModuleId.'.'.$toPath.'.'.$toClass.'.'.$toMethod.'.'.$toMethodArg.'.'.$version));

	$connection = Application::getConnection();
	$sqlHelper = $connection->getSqlHelper();

	$fromModuleId = $sqlHelper->forSql($fromModuleId);
	$eventType = $sqlHelper->forSql($eventType);
	$toModuleId = $sqlHelper->forSql($toModuleId);
	$toClass = $sqlHelper->forSql($toClass);
	$toMethod = $sqlHelper->forSql($toMethod);
	$toPath = $sqlHelper->forSql($toPath);
	$toMethodArg = $sqlHelper->forSql($toMethodArg);

	$fields =  '(SORT, FROM_MODULE_ID, MESSAGE_ID, TO_MODULE_ID, TO_CLASS, TO_METHOD, TO_PATH, TO_METHOD_ARG, VERSION, UNIQUE_ID)';
	$values = "(".$sort.", '".$fromModuleId."', '".$eventType."', '".$toModuleId."', "."   '".$toClass."', '".$toMethod."', '".$toPath."', '".$toMethodArg."', ".$version.", '".$uniqueID."')";
	$sql = $sqlHelper->getInsertIgnore('b_module_to_module', $fields, 'VALUES ' . $values);
	$connection->queryExecute($sql);

	$this->clearLoadedHandlers();
}