CodeExplorer setCustomerReview example
$reviewResult = ReviewLoaderResult::
createFrom($reviews);
$reviewResult->
setProductId($request->
get('productId'
));
$reviewResult->
setParentId($request->
get('parentId'
));
$aggregation =
$reviews->
getAggregations()->
get('ratingMatrix'
);
$matrix =
new RatingMatrix([]);
if ($aggregation instanceof TermsResult
) { $matrix =
new RatingMatrix($aggregation->
getBuckets());
} $reviewResult->
setMatrix($matrix);
$reviewResult->
setCustomerReview($this->
getCustomerReview($productId,
$context));
$reviewResult->
setTotalReviews($matrix->
getTotalReviewCount());
return $reviewResult;
} private function createCriteria(Request
$request, SalesChannelContext
$context): Criteria
{ $limit =
(int) $request->
get('limit', self::LIMIT
);
$page =
(int) $request->
get('p', self::DEFAULT_PAGE
);
$offset =
$limit *
($page - 1
);