14 use Magento\Sales\Api\Data\InvoiceCommentInterfaceFactory;
15 use Magento\Sales\Api\Data\InvoiceCommentSearchResultInterfaceFactory;
20 use Psr\Log\LoggerInterface;
30 private $commentResource;
35 private $commentFactory;
40 private $searchResultFactory;
45 private $collectionProcessor;
50 private $invoiceCommentSender;
55 private $invoiceRepository;
73 InvoiceCommentInterfaceFactory $commentFactory,
74 InvoiceCommentSearchResultInterfaceFactory $searchResultFactory,
78 LoggerInterface $logger =
null 80 $this->commentResource = $commentResource;
81 $this->commentFactory = $commentFactory;
82 $this->searchResultFactory = $searchResultFactory;
83 $this->collectionProcessor = $collectionProcessor;
84 $this->invoiceCommentSender = $invoiceCommentSender
86 $this->invoiceRepository = $invoiceRepository
96 $searchResult = $this->searchResultFactory->create();
107 $entity = $this->commentFactory->create();
118 $this->commentResource->delete(
$entity);
119 }
catch (\Exception $e) {
131 $this->commentResource->save(
$entity);
132 }
catch (\Exception $e) {
139 }
catch (\Exception $exception) {
140 $this->logger->critical($exception);