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

Open in your IDE?
  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\Framework\Routing\Annotation\Entity;
  7. use Shopware\Core\Framework\Routing\Annotation\RouteScope;
  8. use Shopware\Core\Framework\Routing\Annotation\Since;
  9. use Shopware\Core\System\SalesChannel\SalesChannelContext;
  10. use Symfony\Component\HttpFoundation\Request;
  11. use Symfony\Component\Routing\Annotation\Route;
  12. use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
  13. /**
  14.  * @Route(defaults={"_routeScope"={"store-api"}})
  15.  */
  16. #[Package('inventory')]
  17. class ResolveCriteriaProductListingRoute extends AbstractProductListingRoute
  18. {
  19.     private AbstractProductListingRoute $decorated;
  20.     private EventDispatcherInterface $eventDispatcher;
  21.     /**
  22.      * @internal
  23.      */
  24.     public function __construct(AbstractProductListingRoute $decoratedEventDispatcherInterface $eventDispatcher)
  25.     {
  26.         $this->decorated $decorated;
  27.         $this->eventDispatcher $eventDispatcher;
  28.     }
  29.     public function getDecorated(): AbstractProductListingRoute
  30.     {
  31.         return $this->decorated;
  32.     }
  33.     /**
  34.      * @Since("6.2.0.0")
  35.      * @Entity("product")
  36.      * @Route("/store-api/product-listing/{categoryId}", name="store-api.product.listing", methods={"POST"})
  37.      */
  38.     public function load(string $categoryIdRequest $requestSalesChannelContext $contextCriteria $criteria): ProductListingRouteResponse
  39.     {
  40.         $this->eventDispatcher->dispatch(
  41.             new ProductListingCriteriaEvent($request$criteria$context)
  42.         );
  43.         return $this->getDecorated()->load($categoryId$request$context$criteria);
  44.     }
  45. }