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\Model\Merchant\MerchantInterface;
- use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
- use Lc\CaracoleBundle\Resolver\MerchantResolver;
- use Lc\SovBundle\Repository\AbstractStore;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
-
- class TaxRateStore extends AbstractStore
- {
- use MerchantStoreTrait;
-
- protected TaxRateRepositoryQuery $query;
-
- public function __construct(TaxRateRepositoryQuery $query)
- {
- $this->query = $query;
- }
- public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- $query->orderBy('id');
- return $query;
- }
-
- public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
- public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
- public function getAsArray($query = null)
- {
- $taxRates = $this->createDefaultQuery($query)->find();
-
- $taxRatesList = [];
-
- foreach ($taxRates as $taxRate) {
- $taxRatesList[$taxRate->getId()]['title'] = $taxRate->getTitle();
- $taxRatesList[$taxRate->getId()]['value'] = $taxRate->getValue();
- }
-
- $taxRatesList['default']['title'] = $this->merchant->getTaxRate()->getTitle();
- $taxRatesList['default']['value'] = $this->merchant->getTaxRate()->getValue();
-
- return $taxRatesList;
- }
- }
|