src/Core/System/Salutation/SalesChannel/SalutationRoute.php line 32

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\System\Salutation\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('customer-order')]
  12. class SalutationRoute extends AbstractSalutationRoute
  13. {
  14.     /**
  15.      * @internal
  16.      */
  17.     public function __construct(private readonly SalesChannelRepository $salesChannelRepository)
  18.     {
  19.     }
  20.     public function getDecorated(): AbstractSalutationRoute
  21.     {
  22.         throw new DecorationPatternException(self::class);
  23.     }
  24.     #[Route(path'/store-api/salutation'name'store-api.salutation'methods: ['GET''POST'], defaults: ['_entity' => 'salutation'])]
  25.     public function load(Request $requestSalesChannelContext $contextCriteria $criteria): SalutationRouteResponse
  26.     {
  27.         return new SalutationRouteResponse($this->salesChannelRepository->search($criteria$context));
  28.     }
  29. }