|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
-
- namespace domain\Config\TaxRate;
-
- use domain\_\AbstractRepository;
-
- 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;
- }
- }
|