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; } public function getAsFormChoices($query = null): array { $taxRateArray = $this->createDefaultQuery($query)->find(); $taxRateChoices = []; foreach($taxRateArray as $taxRate) { $taxRateChoices[$taxRate->getTitle()] = $taxRate->getId(); } return $taxRateChoices; } }