Ejemplo n.º 1
0
 /**
  * Invoke InvoiceList service
  *
  * @param SearchCriteria $searchCriteria
  * @return \Magento\Framework\Service\V1\Data\SearchResults
  */
 public function invoke(SearchCriteria $searchCriteria)
 {
     $invoices = [];
     foreach ($this->invoiceRepository->find($searchCriteria) as $invoice) {
         $invoices[] = $this->invoiceMapper->extractDto($invoice);
     }
     return $this->searchResultsBuilder->setItems($invoices)->setTotalCount(count($invoices))->setSearchCriteria($searchCriteria)->create();
 }
Ejemplo n.º 2
0
 /**
  * Invoke getInvoice service
  *
  * @param int $id
  * @return \Magento\Sales\Service\V1\Data\Invoice
  * @throws \Magento\Framework\Exception\NoSuchEntityException
  */
 public function invoke($id)
 {
     return $this->invoiceMapper->extractDto($this->invoiceRepository->get($id));
 }