Nevar pievienot vairāk kā 25 tēmas
Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
|
- <?php
-
- namespace Lc\CaracoleBundle\Repository\Config;
-
- use Lc\CaracoleBundle\Resolver\MerchantResolver;
- use Lc\SovBundle\Repository\AbstractStore;
-
- class TaxRateStore extends AbstractStore
- {
- protected TaxRateRepositoryQuery $query;
- protected MerchantResolver $merchantResolver;
-
- public function __construct(TaxRateRepositoryQuery $query, MerchantResolver $merchantResolver)
- {
- $this->query = $query;
- $this->merchantResolver = $merchantResolver;
- }
-
- public function getAsArray()
- {
- $query = $this->query->create();
-
- $taxRatesList = array();
- foreach ($query->find() as $taxRate) {
- $taxRatesList[$taxRate->getId()]['title'] = $taxRate->getTitle();
- $taxRatesList[$taxRate->getId()]['value'] = $taxRate->getValue();
- }
-
- $taxRatesList['default']['title'] = $this->merchantResolver->getCurrent()->getTaxRate()->getTitle();
- $taxRatesList['default']['value'] = $this->merchantResolver->getCurrent()->getTaxRate()->getValue();
-
- return $taxRatesList;
- }
- }
|