Beispiel #1
0
 /**
  * @param Shipment $shipment
  * @return \Magento\Shipping\Model\Resource\Order\Track\Collection
  */
 protected function _getTracksCollection(Shipment $shipment)
 {
     $tracks = $this->_trackCollectionFactory->create()->setShipmentFilter($shipment->getId());
     if ($shipment->getId()) {
         foreach ($tracks as $track) {
             $track->setShipment($shipment);
         }
     }
     return $tracks;
 }
Beispiel #2
0
 /**
  * Returns tracks
  *
  * @return \Magento\Sales\Api\Data\ShipmentTrackInterface[]
  */
 public function getTracks()
 {
     if ($this->getData(ShipmentInterface::TRACKS) === null) {
         $collection = $this->_trackCollectionFactory->create()->setShipmentFilter($this->getId());
         if ($this->getId()) {
             foreach ($collection as $item) {
                 $item->setShipment($this);
             }
             $this->setData(ShipmentInterface::TRACKS, $collection->getItems());
         }
     }
     return $this->getData(ShipmentInterface::TRACKS);
 }
Beispiel #3
0
 /**
  * Retrieve tracks collection.
  *
  * @return \Magento\Sales\Model\Resource\Order\Shipment\Track\Collection
  */
 public function getTracksCollection()
 {
     if (empty($this->_tracks)) {
         $this->_tracks = $this->_trackCollectionFactory->create()->setShipmentFilter($this->getId());
         if ($this->getId()) {
             foreach ($this->_tracks as $track) {
                 $track->setShipment($this);
             }
         }
     }
     return $this->_tracks;
 }