Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/readme-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jkniest committed Aug 22, 2023
2 parents 14b89d8 + 240332c commit 77f82b5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Add new helper method to load a TaxEntity by its value.

## [2.2.1] - 2023-05-26
### Fixed
- Restored compatibility for Shopware 6.4 by removing typehints for **EntityRepository** in util classes.
Expand Down
11 changes: 11 additions & 0 deletions src/Utils/SalesChannelUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,15 @@ public function getTax19(): ?TaxEntity
->search($criteria, Context::createDefaultContext())
->first();
}

public function getTax(int $taxValue): ?TaxEntity
{
$criteria = (new Criteria())
->addFilter(new EqualsFilter('taxRate', $taxValue))
->setLimit(1);

return $this->taxRepository
->search($criteria, Context::createDefaultContext())
->first();
}
}

0 comments on commit 77f82b5

Please sign in to comment.