• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/volume/invoice.php
  • Класс: Bitrix\Crm\Volume\Invoice
  • Вызов: Invoice::countEntity
public function countEntity()
{
	$count = -1;

	$query = $this->prepareQuery();

	if ($this->prepareFilter($query))
	{
		$query
			->registerRuntimeField(new ORM\Fields\ExpressionField('CNT', 'COUNT(%s)', 'ID'))
			->addSelect('CNT')
		;

		$count = 0;
		$res = $query->exec();
		if ($row = $res->fetch())
		{
			$count = $row['CNT'];
		}
	}

	return $count;
}