Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

35 lines
1.0KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Config;
  3. use Lc\CaracoleBundle\Resolver\MerchantResolver;
  4. use Lc\SovBundle\Repository\AbstractStore;
  5. class TaxRateStore extends AbstractStore
  6. {
  7. protected TaxRateRepositoryQuery $query;
  8. protected MerchantResolver $merchantResolver;
  9. public function __construct(TaxRateRepositoryQuery $query, MerchantResolver $merchantResolver)
  10. {
  11. $this->query = $query;
  12. $this->merchantResolver = $merchantResolver;
  13. }
  14. public function getAsArray()
  15. {
  16. $query = $this->query->create();
  17. $taxRatesList = array();
  18. foreach ($query->find() as $taxRate) {
  19. $taxRatesList[$taxRate->getId()]['title'] = $taxRate->getTitle();
  20. $taxRatesList[$taxRate->getId()]['value'] = $taxRate->getValue();
  21. }
  22. $taxRatesList['default']['title'] = $this->merchantResolver->getCurrent()->getTaxRate()->getTitle();
  23. $taxRatesList['default']['value'] = $this->merchantResolver->getCurrent()->getTaxRate()->getValue();
  24. return $taxRatesList;
  25. }
  26. }