• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/shipmentitem.php
  • Класс: BitrixSaleShipmentItem
  • Вызов: ShipmentItem::loadBasketItem
protected function loadBasketItem()
{
	/** @var ShipmentItemCollection $collection */
	$collection = $this->getCollection();

	/** @var Shipment $shipment */
	if (!$shipment = $collection->getShipment())
	{
		throw new MainObjectNotFoundException('Entity "Shipment" not found');
	}

	/** @var ShipmentCollection $shipmentCollection */
	if (!$shipmentCollection = $shipment->getCollection())
	{
		throw new MainObjectNotFoundException('Entity "ShipmentCollection" not found');
	}

	/** @var Order $order */
	if (!$order = $shipmentCollection->getOrder())
	{
		throw new MainObjectNotFoundException('Entity "Order" not found');
	}

	/** @var Basket $basket */
	if (!$basket = $order->getBasket())
	{
		throw new MainObjectNotFoundException('Entity "Basket" not found');
	}

	// [performance]
	// new ShipmentItem binds BasketItem on initialization
	// here we find BasketItem for already saved ShipmentItem (his ID is equal to CODE)
	return $basket->getItemByBasketCode($this->getBasketId());
}