Collection.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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\Address;
  7. use Magento\Sales\Api\Data\OrderAddressSearchResultInterface;
  8. use \Magento\Sales\Model\ResourceModel\Order\Collection\AbstractCollection;
  9. /**
  10. * Flat sales order payment collection
  11. *
  12. * @author Magento Core Team <core@magentocommerce.com>
  13. */
  14. class Collection extends AbstractCollection implements OrderAddressSearchResultInterface
  15. {
  16. /**
  17. * Event prefix
  18. *
  19. * @var string
  20. */
  21. protected $_eventPrefix = 'sales_order_address_collection';
  22. /**
  23. * Event object
  24. *
  25. * @var string
  26. */
  27. protected $_eventObject = 'order_address_collection';
  28. /**
  29. * Model initialization
  30. *
  31. * @return void
  32. */
  33. protected function _construct()
  34. {
  35. $this->_init(
  36. \Magento\Sales\Model\Order\Address::class,
  37. \Magento\Sales\Model\ResourceModel\Order\Address::class
  38. );
  39. }
  40. /**
  41. * Redeclare after load method for dispatch event
  42. *
  43. * @return $this
  44. */
  45. protected function _afterLoad()
  46. {
  47. parent::_afterLoad();
  48. $this->_eventManager->dispatch($this->_eventPrefix . '_load_after', [$this->_eventObject => $this]);
  49. return $this;
  50. }
  51. }