• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/entity/paymentdocumentsrepository.php
  • Класс: Bitrix\Crm\Entity\objects
  • Вызов: objects::getDocumentsForEntity
public function getDocumentsForEntity(int $ownerTypeId, int $ownerId): Main\Result
{
	$this->ownerTypeId = $ownerTypeId;
	$this->ownerId = $ownerId;
	$this->paidSum = 0.0;
	$this->orders = [];

	$result = new Main\Result;

	if ($this->fetchEntity())
	{
		$this->fetchOrderIds();
		$this->fetchOrders();
		$this->fetchDocuments();
		$this->subscribeToPullEvents();

		$result->setData($this->formatResult());
	}
	else
	{
		$result->addError(
			new Main\Error("Entity {$this->ownerId} not found", static::ERROR_CODE_ENTITY_NOT_FOUND)
		);
	}

	return $result;
}