vendor/shopware/core/Content/Product/SalesChannel/Listing/ProductListingResult.php line 9

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Content\Product\SalesChannel\Listing;
  3. use Shopware\Core\Content\Product\ProductCollection;
  4. use Shopware\Core\Content\Product\SalesChannel\Sorting\ProductSortingCollection;
  5. use Shopware\Core\Framework\DataAbstractionLayer\Search\EntitySearchResult;
  6. use Shopware\Core\Framework\Log\Package;
  7. /**
  8.  * @extends EntitySearchResult<ProductCollection>
  9.  */
  10. #[Package('inventory')]
  11. class ProductListingResult extends EntitySearchResult
  12. {
  13.     protected ?string $sorting null;
  14.     /**
  15.      * @var array<string, int|float|string|bool|array<mixed>|null>
  16.      */
  17.     protected array $currentFilters = [];
  18.     protected ProductSortingCollection $availableSortings;
  19.     protected ?string $streamId null;
  20.     /**
  21.      * @param int|float|string|bool|array<mixed>|null       $value
  22.      */
  23.     public function addCurrentFilter(string $key$value): void
  24.     {
  25.         $this->currentFilters[$key] = $value;
  26.     }
  27.     public function getAvailableSortings(): ProductSortingCollection
  28.     {
  29.         return $this->availableSortings;
  30.     }
  31.     public function setAvailableSortings(ProductSortingCollection $availableSortings): void
  32.     {
  33.         $this->availableSortings $availableSortings;
  34.     }
  35.     public function getSorting(): ?string
  36.     {
  37.         return $this->sorting;
  38.     }
  39.     public function setSorting(?string $sorting): void
  40.     {
  41.         $this->sorting $sorting;
  42.     }
  43.     /**
  44.      * @return array<string, int|float|string|bool|array<mixed>|null>
  45.      */
  46.     public function getCurrentFilters(): array
  47.     {
  48.         return $this->currentFilters;
  49.     }
  50.     /**
  51.      * @return int|float|string|bool|array<mixed>|null
  52.      */
  53.     public function getCurrentFilter(string $key)
  54.     {
  55.         return $this->currentFilters[$key] ?? null;
  56.     }
  57.     public function getApiAlias(): string
  58.     {
  59.         return 'product_listing';
  60.     }
  61.     public function setStreamId(?string $streamId): void
  62.     {
  63.         $this->streamId $streamId;
  64.     }
  65.     public function getStreamId(): ?string
  66.     {
  67.         return $this->streamId;
  68.     }
  69. }