throw new DecorationPatternException(self::
class);
} #[Route(path: '/store-api/product/{productId}', name: 'store-api.product.detail', methods: ['POST'], defaults: ['_entity' => 'product'])]
public function load(string
$productId, Request
$request, SalesChannelContext
$context, Criteria
$criteria): ProductDetailRouteResponse
{ return Profiler::
trace('product-detail-route',
function D
) use ($productId,
$request,
$context,
$criteria) { $mainVariantId =
$this->
checkVariantListingConfig($productId,
$context);
$productId =
$mainVariantId ??
$this->
findBestVariant($productId,
$context);
$this->
addFilters($context,
$criteria);
$criteria->
setIds([$productId]);
$criteria->
setTitle('product-detail-route'
);
$product =
$this->productRepository
->
search($criteria,
$context) ->
first();
if (!
($product instanceof SalesChannelProductEntity
)) { throw new ProductNotFoundException($productId);
}