• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/payableitemcollection.php
  • Класс: BitrixSalePayableItemCollection
  • Вызов: PayableItemCollection::load
static function load(Payment $payment)
{
	$collection = static::createCollectionObject();
	$collection->setPayment($payment);

	if ($payment->getId() > 0)
	{
		$registry = Registry::getInstance(static::getRegistryType());

		/** @var PayableItem $entity */
		$entity = $registry->get(Registry::ENTITY_PAYABLE_SHIPMENT);

		$items = $entity::loadForPayment($payment->getId());
		foreach ($items as $item)
		{
			$item->setCollection($collection);
			$collection->addItem($item);
		}

		/** @var PayableItem $entity */
		$entity = $registry->get(Registry::ENTITY_PAYABLE_BASKET_ITEM);

		$items = $entity::loadForPayment($payment->getId());
		foreach ($items as $item)
		{
			$item->setCollection($collection);
			$collection->addItem($item);
		}
	}

	return $collection;
}