• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/delivery/extra_services/manager.php
  • Класс: BitrixSaleDeliveryExtraServicesManager
  • Вызов: Manager::getObjectsForShipment
static function getObjectsForShipment(int $shipmentId, int $deliveryId, string $currency): array
{
	$result = [];

	$extraServiceValuesList = ShipmentExtraServiceTable::getList(
		[
			'filter' => [
				'=SHIPMENT_ID' => $shipmentId,
				'!=ID' => self::getStoresValueId($deliveryId)
			],
			'select' => [
				'*',
				'EXTRA_SERVICE',
			]
		]
	);

	while ($extraServiceValue = $extraServiceValuesList->fetchObject())
	{
		$extraService = $extraServiceValue->getExtraService();

		$className = $extraService->getClassName();

		/** @var Base $extraServiceValue */
		$extraServiceInstance = new $className(
			$extraService->getId(),
			[
				'NAME' => $extraService->getName(),
				'CODE' => $extraService->getCode(),
				'INIT_VALUE' => $extraService->getInitValue(),
				'PARAMS' => $extraService->getParams()
			],
			$currency,
			$extraServiceValue->getValue()
		);

		if (!$extraServiceInstance instanceof Base)
		{
			throw new SystemException(
				sprintf(
					'Object is not of expected type: %s',
					Base::class
				)
			);
		}

		$result[$extraServiceValue['EXTRA_SERVICE_ID']] = $extraServiceInstance;
	}

	return $result;
}