You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TaxRateStore.php 1.0KB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1234567891011121314151617181920212223242526272829303132333435
  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. }