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

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