Exemplo n.º 1
0
 /**
  * Returns invoice items
  *
  * @return \Magento\Sales\Api\Data\InvoiceItemInterface[]
  */
 public function getItems()
 {
     if ($this->getData(InvoiceInterface::ITEMS) === null && $this->getId()) {
         $collection = $this->_invoiceItemCollectionFactory->create()->setInvoiceFilter($this->getId());
         foreach ($collection as $item) {
             $item->setInvoice($this);
         }
         $this->setData(InvoiceInterface::ITEMS, $collection->getItems());
     }
     return $this->getData(InvoiceInterface::ITEMS);
 }
Exemplo n.º 2
0
 /**
  * Get invoice items collection
  *
  * @return \Magento\Sales\Model\Resource\Order\Invoice\Item\Collection
  */
 public function getItemsCollection()
 {
     if (empty($this->_items)) {
         $this->_items = $this->_invoiceItemCollectionFactory->create()->setInvoiceFilter($this->getId());
         if ($this->getId()) {
             foreach ($this->_items as $item) {
                 $item->setInvoice($this);
             }
         }
     }
     return $this->_items;
 }