OrderCoinExchangeManager.php 765 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace app\frontend\modules\order\coinExchange;
  3. use app\frontend\modules\order\models\PreOrder;
  4. class OrderCoinExchangeManager
  5. {
  6. /**
  7. * @var OrderCoinExchangeCollection
  8. */
  9. private $orderCoinExchangeCollection;
  10. /**
  11. * @var PreOrder
  12. */
  13. private $order;
  14. public function __construct(PreOrder $preOrder)
  15. {
  16. $this->order = $preOrder;
  17. }
  18. public function getOrderCoinExchangeCollection()
  19. {
  20. if (!isset($this->orderCoinExchangeCollection)) {
  21. $this->orderCoinExchangeCollection = new OrderCoinExchangeCollection();
  22. $this->order->setRelation('orderCoinExchanges', $this->orderCoinExchangeCollection);
  23. }
  24. return $this->orderCoinExchangeCollection;
  25. }
  26. }