13 use Magento\Sales\Api\Data\InvoiceSearchResultInterfaceFactory as SearchResultFactory;
40 private $collectionProcessor;
53 $this->metadata = $invoiceMetadata;
55 $this->collectionProcessor = $collectionProcessor ?: $this->getCollectionProcessor();
66 public function get(
$id)
69 throw new \Magento\Framework\Exception\InputException(
__(
'An ID is needed. Set the ID and try again.'));
71 if (!isset($this->registry[
$id])) {
73 $entity = $this->metadata->getNewInstance()->load(
$id);
76 __(
"The entity that was requested doesn't exist. Verify the entity and try again.")
81 return $this->registry[
$id];
89 return $this->metadata->getNewInstance();
101 $collection = $this->searchResultFactory->create();
115 $this->metadata->getMapper()->delete(
$entity);
116 unset($this->registry[
$entity->getEntityId()]);
140 $this->metadata->getMapper()->save(
$entity);
142 return $this->registry[
$entity->getEntityId()];
151 private function getCollectionProcessor()
153 if (!$this->collectionProcessor) {
158 return $this->collectionProcessor;
save(\Magento\Sales\Api\Data\InvoiceInterface $entity)
getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
__construct(Metadata $invoiceMetadata, SearchResultFactory $searchResultFactory, CollectionProcessorInterface $collectionProcessor=null)