src/Core/System/Language/SalesChannel/LanguageRoute.php line 35
<?php declare(strict_types=1);
namespace Shopware\Core\System\Language\SalesChannel;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\Log\Package;
use Shopware\Core\Framework\Plugin\Exception\DecorationPatternException;
use Shopware\Core\System\SalesChannel\Entity\SalesChannelRepository;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
#[Route(defaults: ['_routeScope' => ['store-api']])]
#[Package('system-settings')]
class LanguageRoute extends AbstractLanguageRoute
{
/**
* @internal
*/
public function __construct(private readonly SalesChannelRepository $repository)
{
}
public function getDecorated(): AbstractLanguageRoute
{
throw new DecorationPatternException(self::class);
}
#[Route(path: '/store-api/language', name: 'store-api.language', methods: ['GET', 'POST'], defaults: ['_entity' => 'language'])]
public function load(Request $request, SalesChannelContext $context, Criteria $criteria): LanguageRouteResponse
{
$criteria->addAssociation('translationCode');
return new LanguageRouteResponse(
$this->repository->search($criteria, $context)
);
}
}