Beispiel #1
0
 /**
  * Returns items
  *
  * @return \Magento\Sales\Api\Data\ShipmentItemInterface[]
  */
 public function getItems()
 {
     if ($this->getData(ShipmentInterface::ITEMS) === null) {
         $collection = $this->_shipmentItemCollectionFactory->create()->setShipmentFilter($this->getId());
         if ($this->getId()) {
             foreach ($collection as $item) {
                 $item->setShipment($this);
             }
             $this->setData(ShipmentInterface::ITEMS, $collection->getItems());
         }
     }
     return $this->getData(ShipmentInterface::ITEMS);
 }
Beispiel #2
0
 /**
  * @return mixed
  */
 public function getItemsCollection()
 {
     if (empty($this->_items)) {
         $this->_items = $this->_shipmentItemCollectionFactory->create()->setShipmentFilter($this->getId());
         if ($this->getId()) {
             foreach ($this->_items as $item) {
                 $item->setShipment($this);
             }
         }
     }
     return $this->_items;
 }