• Модуль: rest
  • Путь к файлу: ~/bitrix/modules/rest/lib/statmethod.php
  • Класс: BitrixRestStatMethodTable
  • Вызов: StatMethodTable::addMethod
static function addMethod($methodName, $methodType)
{
	$connection = MainApplication::getConnection();
	$helper = $connection->getSqlHelper();

	$sqlTableName = static::getTableName();
	$sqlMethodName = $helper->forSql($methodName);
	$sqlMethodType = in_array(
		$methodType, [
			static::METHOD_TYPE_METHOD,
			static::METHOD_TYPE_EVENT,
			static::METHOD_TYPE_PLACEMENT,
			static::METHOD_TYPE_ROBOT,
			static::METHOD_TYPE_ACTIVITY,
		]
	) ? $methodType : self::METHOD_TYPE_METHOD;

	$query = "INSERT IGNORE INTO {$sqlTableName} (NAME, METHOD_TYPE) VALUES ('{$sqlMethodName}', '{$sqlMethodType}')";
	$connection->query($query);
}