Collection.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Tax\Model\ResourceModel\Sales\Order\Tax;
  7. /**
  8. * Order Tax Collection
  9. *
  10. * @author Magento Core Team <core@magentocommerce.com>
  11. */
  12. class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
  13. {
  14. /**
  15. * Resource initialization
  16. *
  17. * @return void
  18. */
  19. protected function _construct()
  20. {
  21. $this->_init(
  22. \Magento\Tax\Model\Sales\Order\Tax::class,
  23. \Magento\Tax\Model\ResourceModel\Sales\Order\Tax::class
  24. );
  25. }
  26. /**
  27. * Retrieve order tax collection by order identifier
  28. *
  29. * @param \Magento\Framework\DataObject $order
  30. * @return \Magento\Tax\Model\ResourceModel\Sales\Order\Tax\Collection
  31. */
  32. public function loadByOrder($order)
  33. {
  34. $orderId = $order->getId();
  35. $this->getSelect()->where('main_table.order_id = ?', (int)$orderId)->order('process');
  36. return $this->load();
  37. }
  38. }