Collection.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Model\ResourceModel\Order\Shipment\Track;
  7. use Magento\Sales\Api\Data\ShipmentTrackSearchResultInterface;
  8. use Magento\Sales\Model\ResourceModel\Order\Collection\AbstractCollection;
  9. /**
  10. * Flat sales order shipment tracks collection
  11. *
  12. * @api
  13. * @author Magento Core Team <core@magentocommerce.com>
  14. * @since 100.0.2
  15. */
  16. class Collection extends AbstractCollection implements ShipmentTrackSearchResultInterface
  17. {
  18. /**
  19. * Event prefix
  20. *
  21. * @var string
  22. */
  23. protected $_eventPrefix = 'sales_order_shipment_track_collection';
  24. /**
  25. * Event object
  26. *
  27. * @var string
  28. */
  29. protected $_eventObject = 'order_shipment_track_collection';
  30. /**
  31. * Order field
  32. *
  33. * @var string
  34. */
  35. protected $_orderField = 'order_id';
  36. /**
  37. * Model initialization
  38. *
  39. * @return void
  40. */
  41. protected function _construct()
  42. {
  43. $this->_init(
  44. \Magento\Sales\Model\Order\Shipment\Track::class,
  45. \Magento\Sales\Model\ResourceModel\Order\Shipment\Track::class
  46. );
  47. }
  48. /**
  49. * Set shipment filter
  50. *
  51. * @param int $shipmentId
  52. * @return $this
  53. */
  54. public function setShipmentFilter($shipmentId)
  55. {
  56. $this->addFieldToFilter('parent_id', $shipmentId);
  57. return $this;
  58. }
  59. }