/** * load entity * * @param int $id * @return \Magento\Sales\Api\Data\OrderInterface * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Framework\Exception\NoSuchEntityException */ public function get($id) { if (!$id) { throw new InputException(__('Id required')); } if (!isset($this->registry[$id])) { /** @var \Magento\Sales\Api\Data\OrderInterface $entity */ $entity = $this->metadata->getNewInstance()->load($id); if (!$entity->getEntityId()) { throw new NoSuchEntityException(__('Requested entity doesn\'t exist')); } $this->registry[$id] = $entity; } return $this->registry[$id]; }
/** * load entity * * @param int $id * @return OrderItemInterface * @throws InputException * @throws NoSuchEntityException */ public function get($id) { if (!$id) { throw new InputException(__('ID required')); } if (!isset($this->registry[$id])) { /** @var OrderItemInterface $orderItem */ $orderItem = $this->metadata->getNewInstance()->load($id); if (!$orderItem->getItemId()) { throw new NoSuchEntityException(__('Requested entity doesn\'t exist')); } $this->addProductOption($orderItem); $this->registry[$id] = $orderItem; } return $this->registry[$id]; }
/** * @return \Magento\Sales\Api\Data\InvoiceInterface */ public function create() { return $this->metadata->getNewInstance(); }