|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
-
- namespace common\logic\Config\TaxRate\Repository;
-
- use common\logic\AbstractRepository;
- use common\logic\Config\TaxRate\Model\TaxRate;
-
- class TaxRateRepository extends AbstractRepository
- {
- protected TaxRateRepositoryQuery $query;
-
- public function loadDependencies(): void
- {
- $this->loadQuery(TaxRateRepositoryQuery::class);
- }
-
- public function getDefaultOptionsSearch(): array
- {
- return [
- self::WITH => [],
- self::JOIN_WITH => [],
- self::ORDER_BY => 'pourcent ASC',
- self::ATTRIBUTE_ID_PRODUCER => ''
- ];
- }
-
- public function findOneTaxRateById(int $id): ?TaxRate
- {
- return $this->createQuery()
- ->filterById($id)
- ->findOne();
- }
-
- public function findTaxRates(): array
- {
- return $this->createQuery()
- ->find();
- }
-
- public function findTaxRatesAsArray(): array
- {
- $taxRateArrayReturn = [];
- $taxRateArray = $this->findTaxRates();
-
- foreach ($taxRateArray as $taxRate) {
- $taxRateArrayReturn[$taxRate->id] = $taxRate;
- }
-
- return $taxRateArrayReturn;
- }
- }
|