vendor/shopware/core/System/Language/SalesChannel/LanguageRoute.php line 35

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\System\Language\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\SalesChannel\Entity\SalesChannelRepository;
  7. use Shopware\Core\System\SalesChannel\SalesChannelContext;
  8. use Symfony\Component\HttpFoundation\Request;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. #[Route(defaults: ['_routeScope' => ['store-api']])]
  11. #[Package('system-settings')]
  12. class LanguageRoute extends AbstractLanguageRoute
  13. {
  14.     /**
  15.      * @internal
  16.      */
  17.     public function __construct(private readonly SalesChannelRepository $repository)
  18.     {
  19.     }
  20.     public function getDecorated(): AbstractLanguageRoute
  21.     {
  22.         throw new DecorationPatternException(self::class);
  23.     }
  24.     #[Route(path'/store-api/language'name'store-api.language'methods: ['GET''POST'], defaults: ['_entity' => 'language'])]
  25.     public function load(Request $requestSalesChannelContext $contextCriteria $criteria): LanguageRouteResponse
  26.     {
  27.         $criteria->addAssociation('translationCode');
  28.         return new LanguageRouteResponse(
  29.             $this->repository->search($criteria$context)
  30.         );
  31.     }
  32. }