示例#1
0
 /**
  * Invoke ShipmentList service
  *
  * @param SearchCriteria $searchCriteria
  * @return \Magento\Framework\Service\V1\Data\SearchResults
  */
 public function invoke(SearchCriteria $searchCriteria)
 {
     $shipments = [];
     foreach ($this->shipmentRepository->find($searchCriteria) as $shipment) {
         $shipments[] = $this->shipmentMapper->extractDto($shipment);
     }
     return $this->searchResultsBuilder->setItems($shipments)->setTotalCount(count($shipments))->setSearchCriteria($searchCriteria)->create();
 }
示例#2
0
 /**
  * Invoke getShipment service
  *
  * @param int $id
  * @return \Magento\Sales\Service\V1\Data\Shipment
  * @throws \Magento\Framework\Exception\NoSuchEntityException
  */
 public function invoke($id)
 {
     return $this->shipmentMapper->extractDto($this->shipmentRepository->get($id));
 }