You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- <?php
-
- namespace Lc\CaracoleBundle\Repository\Config;
-
- use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
- use Lc\CaracoleBundle\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;
- }
- }
|