ProductViewBuilder should accept ProductVariationFieldRendererInterface instead of specific implementation

Created on 4 September 2025, about 1 month ago

\Drupal\commerce_product\ProductViewBuilder::__construct expects ProductVariationFieldRenderer $variation_field_renderer, which is a specific implementation of \Drupal\commerce_product\ProductVariationFieldRendererInterface.

The constructor should accept an interface instead of an implementation, otherwise it is not possible to decorate the service commerce_product.variation_field_renderer.

php.ERROR: TypeError: Drupal\commerce_product\ProductViewBuilder::__construct(): Argument #7 ($variation_field_renderer) must be of type Drupal\commerce_product\ProductVariationFieldRenderer, Drupal\example\RawProductVariationFieldRenderer given, called in /var/www/html/web/modules/contrib/commerce/modules/product/src/ProductViewBuilder.php on line 65 in Drupal\commerce_product\ProductViewBuilder->__construct()
🐛 Bug report
Status

Active

Version

3.0

Component

Product

Created by

🇷🇺Russia niklan Russia, Perm

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024