vendor/shopware/core/Content/Product/SalesChannel/Listing/ResolveCriteriaProductListingRoute.php line 33

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Content\Product\SalesChannel\Listing;
  3. use Shopware\Core\Content\Product\Events\ProductListingCriteriaEvent;
  4. use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
  5. use Shopware\Core\Framework\Log\Package;
  6. use Shopware\Core\System\SalesChannel\SalesChannelContext;
  7. use Symfony\Component\HttpFoundation\Request;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
  10. #[Route(defaults: ['_routeScope' => ['store-api']])]
  11. #[Package('inventory')]
  12. class ResolveCriteriaProductListingRoute extends AbstractProductListingRoute
  13. {
  14.     /**
  15.      * @internal
  16.      */
  17.     public function __construct(private readonly AbstractProductListingRoute $decorated, private readonly EventDispatcherInterface $eventDispatcher)
  18.     {
  19.     }
  20.     public function getDecorated(): AbstractProductListingRoute
  21.     {
  22.         return $this->decorated;
  23.     }
  24.     #[Route(path'/store-api/product-listing/{categoryId}'name'store-api.product.listing'methods: ['POST'], defaults: ['_entity' => 'product'])]
  25.     public function load(string $categoryIdRequest $requestSalesChannelContext $contextCriteria $criteria): ProductListingRouteResponse
  26.     {
  27.         $this->eventDispatcher->dispatch(
  28.             new ProductListingCriteriaEvent($request$criteria$context)
  29.         );
  30.         return $this->getDecorated()->load($categoryId$request$context$criteria);
  31.     }
  32. }