• Модуль: rest
  • Путь к файлу: ~/bitrix/modules/rest/lib/eventoffline.php
  • Класс: BitrixRestEventOfflineTable
  • Вызов: EventOfflineTable::markEvents
static function markEvents($filter, $order, $limit)
{
	$processId = static::getProcessId();

	$limit = intval($limit);
	$query = new EventOfflineQuery(static::getEntity());
	$query->setOrder($order);
	$query->setLimit($limit);

	if (is_array($filter))
	{
		foreach ($filter as $key => $value)
		{
			$matches = [];
			if (preg_match('/^([W]{1,2})(.+)/', $key, $matches) && $matches[0] === $key)
			{
				if (
					!is_string($matches[2])
					|| !is_string($matches[1])
				)
				{
					throw new ArgumentTypeException('FILTER_KEYS', 'string');
				}
				if (is_array($value) || is_object($value))
				{
					throw new ArgumentTypeException($key);
				}
				$query->where(
					$matches[2],
					$matches[1],
					$value
				);
			}
			else
			{
				if (!is_string($key))
				{
					throw new ArgumentTypeException('FILTER_KEYS', 'string');
				}
				if (is_array($value) || is_object($value))
				{
					throw new ArgumentTypeException($key);
				}
				$query->where(
					$key,
					$value
				);
			}
		}
	}

	$sql = $query->getMarkQuery($processId);

	MainApplication::getConnection()->query($sql);

	return $processId;
}