Collection.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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;
  7. use Magento\Sales\Api\Data\ShipmentSearchResultInterface;
  8. use Magento\Sales\Model\ResourceModel\Order\Collection\AbstractCollection;
  9. /**
  10. * Sales order shipment collection
  11. *
  12. * @api
  13. * @author Magento Core Team <core@magentocommerce.com>
  14. * @since 100.0.2
  15. */
  16. class Collection extends AbstractCollection implements ShipmentSearchResultInterface
  17. {
  18. /**
  19. * @var string
  20. */
  21. protected $_idFieldName = 'entity_id';
  22. /**
  23. * Event prefix
  24. *
  25. * @var string
  26. */
  27. protected $_eventPrefix = 'sales_order_shipment_collection';
  28. /**
  29. * Event object
  30. *
  31. * @var string
  32. */
  33. protected $_eventObject = 'order_shipment_collection';
  34. /**
  35. * Order field for setOrderFilter
  36. *
  37. * @var string
  38. */
  39. protected $_orderField = 'order_id';
  40. /**
  41. * Model initialization
  42. *
  43. * @return void
  44. */
  45. protected function _construct()
  46. {
  47. $this->_init(
  48. \Magento\Sales\Model\Order\Shipment::class,
  49. \Magento\Sales\Model\ResourceModel\Order\Shipment::class
  50. );
  51. }
  52. /**
  53. * Unserialize packages in each item
  54. *
  55. * @return $this
  56. */
  57. protected function _afterLoad()
  58. {
  59. foreach ($this->_items as $item) {
  60. $this->getResource()->unserializeFields($item);
  61. }
  62. return parent::_afterLoad();
  63. }
  64. }