• Модуль: imopenlines
  • Путь к файлу: ~/bitrix/modules/imopenlines/lib/queuemanager.php
  • Класс: BitrixImOpenLinesQueueManager
  • Вызов: QueueManager::getConfigQueue
public function getConfigQueue()
{
	$result = [];

	$raw = ConfigQueueTable::getList([
		'select' => [
			'ID',
			'SORT',
			'CONFIG_ID',
			'ENTITY_ID',
			'ENTITY_TYPE'
		],
		'filter' => ['=CONFIG_ID' => $this->idLine],
		'order' => [
			'SORT' => 'ASC',
			'ID' => 'ASC'
		],
	]);

	while ($row = $raw->fetch())
	{
		$result[$row['ID']] = $row;
	}

	//TODO: For migration
	if(count($result) === 0)
	{
		$raw = Queue::getList([
			'select' => [
				'SORT',
				'USER_ID'
			],
			'filter' => [
				'=CONFIG_ID' => $this->idLine,
				'=USER.ACTIVE' => 'Y'
			],
			'order' => [
				'SORT' => 'ASC',
				'ID' => 'ASC'
			],
		]);

		while ($row = $raw->fetch())
		{
			$fieldsAdd = [
				'SORT' => $row['SORT'],
				'CONFIG_ID' => $this->idLine,
				'ENTITY_ID' => $row['USER_ID'],
				'ENTITY_TYPE' => 'user',
			];

			$resultAdd = ConfigQueueTable::add($fieldsAdd);
			if($resultAdd->isSuccess())
			{
				$idAdd = $resultAdd->getId();
				$result[$idAdd] = array_merge(['ID' => $idAdd], $fieldsAdd);
			}
		}
	}

	return $result;
}