SyncCountableDataAgent::processCountableEntities

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. SyncCountableDataAgent
  4. processCountableEntities
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/agent/activity/synccountabledataagent.php
  • Класс: Bitrix\Crm\Agent\Activity\SyncCountableDataAgent
  • Вызов: SyncCountableDataAgent::processCountableEntities
private function processCountableEntities(array $result): array
{
	$limit = $this->getLimit();
	$lastEntityId = ($result['lastEntityCountableEntityId'] ?? 0);
	$lastEntityTypeId = ($result['lastEntityCountableEntityTypeId'] ?? 0);
	$processedCount = 0;

	$entities = $this->getCountableEntityList($lastEntityTypeId, $lastEntityId, $limit);
	foreach ($entities as $entity)
	{
		$entityId = (int)$entity['ENTITY_ID'];
		$entityTypeId = (int)$entity['ENTITY_TYPE_ID'];
		$result['steps']++;
		$processedCount++;

		if ($entity['DELETED'])
		{
			if (\CCrmOwnerType::isCorrectEntityTypeId($entityTypeId) && $entityId > 0)
			{
				EntityCountableActivityTable::deleteByEntity(new ItemIdentifier($entityTypeId, $entityId));
				$this->resetCounterByEntity($entityTypeId, $entityId);
			}
		}
		else
		{
			$this->synchronizeEntityData($entity);
		}
	}

	$result['lastEntityCountableEntityId'] = $lastEntityId;
	$result['lastEntityCountableEntityTypeId'] = $lastEntityTypeId;

	if ($processedCount < $limit)
	{
		$result['currentStep'] = self::STEP_UNCOMPLETED_ACTIVITIES;
	}

	return $result;
}

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