Exemplo n.º 1
0
 /**
  * Invoke ShipmentCommentsList service
  *
  * @param int $id
  * @return \Magento\Sales\Service\V1\Data\CommentSearchResults
  */
 public function invoke($id)
 {
     $this->criteriaBuilder->addFilter(['eq' => $this->filterBuilder->setField('parent_id')->setValue($id)->create()]);
     $criteria = $this->criteriaBuilder->create();
     $comments = [];
     foreach ($this->commentRepository->find($criteria) as $comment) {
         $comments[] = $this->commentMapper->extractDto($comment);
     }
     return $this->searchResultsBuilder->setItems($comments)->setSearchCriteria($criteria)->setTotalCount(count($comments))->create();
 }