15 use Magento\Sales\Api\Data\CreditmemoSearchResultInterfaceFactory as SearchResultFactory;
44 private $collectionProcessor;
59 $this->collectionProcessor = $collectionProcessor ?: $this->getCollectionProcessor();
70 public function get(
$id)
75 if (!isset($this->registry[
$id])) {
77 $entity = $this->metadata->getNewInstance()->load(
$id);
80 __(
"The entity that was requested doesn't exist. Verify the entity and try again.")
85 return $this->registry[
$id];
95 return $this->metadata->getNewInstance();
107 $searchResult = $this->searchResultFactory->create();
110 return $searchResult;
123 $this->metadata->getMapper()->delete(
$entity);
124 unset($this->registry[
$entity->getEntityId()]);
125 }
catch (\Exception $e) {
141 $this->metadata->getMapper()->save(
$entity);
145 }
catch (\Exception $e) {
148 return $this->registry[
$entity->getEntityId()];
157 private function getCollectionProcessor()
159 if (!$this->collectionProcessor) {
164 return $this->collectionProcessor;
save(\Magento\Sales\Api\Data\CreditmemoInterface $entity)
__construct(Metadata $metadata, SearchResultFactory $searchResultFactory, CollectionProcessorInterface $collectionProcessor=null)
getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)