Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

TaxRateStore.php 1.5KB

3 lat temu
3 lat temu
3 lat temu
3 lat temu
3 lat temu
3 lat temu
3 lat temu
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. }