vendor/shopware/core/System/Currency/SalesChannel/CurrencyRoute.php line 34

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\System\Currency\SalesChannel;
  3. use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
  4. use Shopware\Core\Framework\Log\Package;
  5. use Shopware\Core\Framework\Plugin\Exception\DecorationPatternException;
  6. use Shopware\Core\System\Currency\CurrencyCollection;
  7. use Shopware\Core\System\SalesChannel\Entity\SalesChannelRepository;
  8. use Shopware\Core\System\SalesChannel\SalesChannelContext;
  9. use Symfony\Component\HttpFoundation\Request;
  10. use Symfony\Component\Routing\Annotation\Route;
  11. #[Route(defaults: ['_routeScope' => ['store-api']])]
  12. #[Package('inventory')]
  13. class CurrencyRoute extends AbstractCurrencyRoute
  14. {
  15.     /**
  16.      * @internal
  17.      */
  18.     public function __construct(private readonly SalesChannelRepository $currencyRepository)
  19.     {
  20.     }
  21.     public function getDecorated(): AbstractCurrencyRoute
  22.     {
  23.         throw new DecorationPatternException(self::class);
  24.     }
  25.     #[Route(path'/store-api/currency'name'store-api.currency'methods: ['GET''POST'], defaults: ['_entity' => 'currency'])]
  26.     public function load(Request $requestSalesChannelContext $contextCriteria $criteria): CurrencyRouteResponse
  27.     {
  28.         /** @var CurrencyCollection $currencyCollection */
  29.         $currencyCollection $this->currencyRepository->search($criteria$context)->getEntities();
  30.         return new CurrencyRouteResponse($currencyCollection);
  31.     }
  32. }