vendor/shopware/storefront/Page/Product/Review/ReviewLoaderResult.php line 10

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Storefront\Page\Product\Review;
  3. use Shopware\Core\Content\Product\Aggregate\ProductReview\ProductReviewEntity;
  4. use Shopware\Core\Content\Product\SalesChannel\Review\RatingMatrix as CoreRatingMatrix;
  5. use Shopware\Core\Framework\Feature;
  6. use Shopware\Storefront\Framework\Page\StorefrontSearchResult;
  7. class ReviewLoaderResult extends StorefrontSearchResult
  8. {
  9.     /**
  10.      * @var string|null
  11.      */
  12.     protected $parentId;
  13.     /**
  14.      * @var string
  15.      */
  16.     protected $productId;
  17.     /**
  18.      * @var StorefrontSearchResult
  19.      */
  20.     protected $reviews;
  21.     /**
  22.      * @deprecated tag:v6.5.0 - Will only accept the `\Shopware\Core\Content\Product\SalesChannel\Review\RatingMatrix`
  23.      *
  24.      * @var RatingMatrix|CoreRatingMatrix
  25.      */
  26.     protected $matrix;
  27.     /**
  28.      * @var ProductReviewEntity|null
  29.      */
  30.     protected $customerReview;
  31.     /**
  32.      * @var int
  33.      */
  34.     protected $totalReviews;
  35.     public function getProductId(): string
  36.     {
  37.         return $this->productId;
  38.     }
  39.     public function setProductId(string $productId): void
  40.     {
  41.         $this->productId = $productId;
  42.     }
  43.     public function getReviews(): StorefrontSearchResult
  44.     {
  45.         return $this->reviews;
  46.     }
  47.     /**
  48.      * @deprecated tag:v6.5.0 - reason:return-type-change - will return `\Shopware\Core\Content\Product\SalesChannel\Review\RatingMatrix` in the future
  49.      */
  50.     public function getMatrix(): RatingMatrix
  51.     {
  52.         return $this->matrix;
  53.     }
  54.     /**
  55.      * @deprecated tag:v6.5.0 - will only accept `\Shopware\Core\Content\Product\SalesChannel\Review\RatingMatrix` in the future
  56.      */
  57.     public function setMatrix(RatingMatrix $matrix): void
  58.     {
  59.         if (!$matrix instanceof CoreRatingMatrix) {
  60.             Feature::triggerDeprecationOrThrow(
  61.                 'v6.5.0.0',
  62.                 'Method `setMatrix()` of class `ReviewLoaderResult` will only accept "Shopware\Core\Content\Product\SalesChannel\Review\RatingMatrix" as input param in v6.5.0.0'
  63.             );
  64.         }
  65.         $this->matrix = $matrix;
  66.     }
  67.     public function getCustomerReview(): ?ProductReviewEntity
  68.     {
  69.         return $this->customerReview;
  70.     }
  71.     public function setCustomerReview(?ProductReviewEntity $customerReview): void
  72.     {
  73.         $this->customerReview = $customerReview;
  74.     }
  75.     public function getTotalReviews(): int
  76.     {
  77.         return $this->totalReviews;
  78.     }
  79.     public function setTotalReviews(int $totalReviews): void
  80.     {
  81.         $this->totalReviews = $totalReviews;
  82.     }
  83.     public function getParentId(): ?string
  84.     {
  85.         return $this->parentId;
  86.     }
  87.     public function setParentId(?string $parentId): void
  88.     {
  89.         $this->parentId = $parentId;
  90.     }
  91. }