FormCounterTable::incCounters

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. FormCounterTable
  4. incCounters
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/webform/internals/formcounter.php
  • Класс: Bitrix\Crm\WebForm\Internals\FormCounterTable
  • Вызов: FormCounterTable::incCounters
static function incCounters($formId, array $counters)
{
	$updateFields = array();

	$counterId = static::getCurrentFormCounter($formId);
	foreach($counters as $key => $value)
	{
		if(is_numeric($key))
		{
			$counterName = $value;
			$incValue = '1';
		}
		else
		{
			$counterName = $key;
			$incValue = (string) $value;
		}
		$updateFields[$counterName] = new \Bitrix\Main\DB\SqlExpression('?# + ' . $incValue, $counterName);
	}

	$result = static::update($counterId, $updateFields);
	return $result->isSuccess();
}

Добавить комментарий