您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

54 行
1.5KB

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