/** * 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(); }
/** * 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)); }