• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/Factory.php
  • Класс: Bitrix\Crm\Service\Factory
  • Вызов: Factory::getStage
public function getStage(string $statusId): ?EO_Status
{
	if (isset($this->stages[$statusId]))
	{
		return $this->stages[$statusId];
	}

	if ($this->isCategoriesSupported())
	{
		$stagesArrays = [];
		foreach ($this->getCategories() as $category)
		{
			$stagesArrays[] = $this->getStages($category->getId())->getAll();
		}

		$stages = $stagesArrays ? array_merge(...$stagesArrays) : [];
	}
	else
	{
		$stages = $this->getStages()->getAll();
	}

	foreach ($stages as $stage)
	{
		if ($stage->getStatusId() === $statusId)
		{
			return $stage;
		}
	}

	return null;
}