vendor/shopware/core/System/Country/SalesChannel/CountryRoute.php line 30

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\System\Country\SalesChannel;
  3. use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
  4. use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
  5. use Shopware\Core\Framework\Log\Package;
  6. use Shopware\Core\Framework\Plugin\Exception\DecorationPatternException;
  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('system-settings')]
  13. class CountryRoute extends AbstractCountryRoute
  14. {
  15.     /**
  16.      * @internal
  17.      */
  18.     public function __construct(private readonly SalesChannelRepository $countryRepository)
  19.     {
  20.     }
  21.     #[Route(path'/store-api/country'name'store-api.country'methods: ['GET''POST'], defaults: ['_entity' => 'country'])]
  22.     public function load(Request $requestCriteria $criteriaSalesChannelContext $context): CountryRouteResponse
  23.     {
  24.         $criteria->addFilter(new EqualsFilter('active'true));
  25.         $result $this->countryRepository->search($criteria$context);
  26.         return new CountryRouteResponse($result);
  27.     }
  28.     protected function getDecorated(): AbstractCountryRoute
  29.     {
  30.         throw new DecorationPatternException(self::class);
  31.     }
  32. }