Contact::getDataCountByType

  1. Bitrix24 API (v. 23.675.0)
  2. sender
  3. Contact
  4. getDataCountByType
  • Модуль: sender
  • Путь к файлу: ~/bitrix/modules/sender/lib/integration/sender/connectors/contact.php
  • Класс: Bitrix\Sender\Integration\Sender\Connectors\Contact
  • Вызов: Contact::getDataCountByType
public function getDataCountByType()
{
	$listId = $this->getFieldValue('LIST_ID', null);
	if (!$listId)
	{
		return array();
	}

	$query = ContactTable::query();
	$query->addSelect('TYPE_ID');
	$query->addSelect(new Entity\ExpressionField('CNT', 'COUNT(TYPE_ID)'));
	$query->addFilter('=CONTACT_LIST.LIST_ID', $listId);
	$query->addGroup('TYPE_ID');
	$list = $query->exec();

	$result = array();
	foreach ($list as $item)
	{
		$typeName = RecipientType::getCode($item['TYPE_ID']);
		$result[$typeName] = $item['CNT'];
	}

	return $result;
}

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