Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

52 lines
1.4KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Config;
  3. use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
  4. use Lc\CaracoleBundle\Repository\AbstractStore;
  5. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  6. class TaxRateStore extends AbstractStore
  7. {
  8. use MerchantStoreTrait;
  9. protected TaxRateRepositoryQuery $query;
  10. public function __construct(TaxRateRepositoryQuery $query)
  11. {
  12. $this->query = $query;
  13. }
  14. public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  15. {
  16. $query->orderBy('id');
  17. return $query;
  18. }
  19. public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  20. {
  21. return $query;
  22. }
  23. public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  24. {
  25. return $query;
  26. }
  27. public function getAsArray($query = null)
  28. {
  29. $taxRates = $this->createDefaultQuery($query)->find();
  30. $taxRatesList = [];
  31. foreach ($taxRates as $taxRate) {
  32. $taxRatesList[$taxRate->getId()]['title'] = $taxRate->getTitle();
  33. $taxRatesList[$taxRate->getId()]['value'] = $taxRate->getValue();
  34. }
  35. $taxRatesList['default']['title'] = $this->merchant->getTaxRate()->getTitle();
  36. $taxRatesList['default']['value'] = $this->merchant->getTaxRate()->getValue();
  37. return $taxRatesList;
  38. }
  39. }