• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/update/entity/contactid.php
  • Класс: Bitrix\Crm\Update\Entity\ContactId
  • Вызов: ContactId::getRowsToProcess
protected function getRowsToProcess(Factory $factory, ?int $lastId): Collection
{
	$query =
		$factory->getDataClass()::query()
			->setSelect([
				$factory->getEntityFieldNameByMap(Item::FIELD_NAME_ID),
				$factory->getEntityFieldNameByMap(Item::FIELD_NAME_CONTACT_ID),
			])
			->where($factory->getEntityFieldNameByMap(Item::FIELD_NAME_CONTACT_ID), 0)
			->addOrder($factory->getEntityFieldNameByMap(Item::FIELD_NAME_ID))
			->setLimit(self::getSingleEntityStepLimit())
	;

	if ($lastId !== null)
	{
		$query->where($factory->getEntityFieldNameByMap(Item::FIELD_NAME_ID), '>', $lastId);
	}

	/** @var Collection $rows */
	$rows = $query->fetchCollection();

	if (count($rows) > 0)
	{
		$this->typeToBindings[$factory->getEntityTypeId()] = BindingHelper::getBulkEntityBindings(
			$factory->getEntityTypeId(),
			$rows->getIdList(),
			\CCrmOwnerType::Contact,
		);
	}

	return $rows;
}