History::migrateStep

  1. Bitrix24 API (v. 23.675.0)
  2. landing
  3. History
  4. migrateStep
  • Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/history.php
  • Класс: BitrixLandingHistory
  • Вызов: History::migrateStep
private function migrateStep(): void
{
	$oldStep = null;

	if ($this->entityType === self::ENTITY_TYPE_LANDING)
	{
		if (!array_key_exists('HISTORY_STEP', LandingTable::getMap()))
		{
			return;
		}

		$landing = LandingTable::query()
			->addSelect('HISTORY_STEP')
			->where('ID', '=', $this->entityId)
			->exec()
			->fetch()
		;
		$oldStep = $landing ? $landing['HISTORY_STEP'] : null;
	}

	if ($this->entityType === self::ENTITY_TYPE_DESIGNER_BLOCK)
	{
		if (!array_key_exists('HISTORY_STEP_DESIGNER', BlockTable::getMap()))
		{
			return;
		}

		$block = BlockTable::query()
			->addSelect('HISTORY_STEP_DESIGNER')
			->where('ID', '=', $this->entityId)
			->exec()
			->fetch()
		;
		$oldStep = $block ? $block['HISTORY_STEP_DESIGNER'] : null;
	}

	$isNewStepExists = HistoryStepTable::query()
		->addSelect('ID')
		->addSelect('STEP')
		->where('ENTITY_ID', '=', $this->entityId)
		->where('ENTITY_TYPE', '=', $this->entityType)
		->exec()
		->fetch()
	;

	if ($oldStep && !$isNewStepExists)
	{
		$this->saveStep((int)$oldStep);
	}
}

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