選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

TaxRateStore.php 1.0KB

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. }