|
- <?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;
- }
- }
|