Migrate ProductReviewsRestApi to API Platform

Edit on GitHub

This document describes how to migrate the ProductReviewsRestApi Glue module to the API Platform ProductReview module.

Prerequisites

Complete the cross-cutting changes described in Migrate Glue REST API to API Platform before proceeding.

Overview

The ProductReviewsRestApi module provided the following storefront endpoints:

Endpoint Operation Old plugin
GET /abstract-products/{sku}/product-reviews Get reviews for abstract product AbstractProductsProductReviewsResourceRoutePlugin
POST /abstract-products/{sku}/product-reviews Submit review for abstract product AbstractProductsProductReviewsResourceRoutePlugin

These are now served by the API Platform ProductReview module.

1. Update module dependencies

composer require spryker/product-review:"^X.Y.Z"
Version

Use the version that includes the API Platform resources. Check the module changelog for the exact version.

2. Remove route plugin from GlueApplicationDependencyProvider

In src/Pyz/Glue/GlueApplication/GlueApplicationDependencyProvider.php, remove the following plugin from getResourceRoutePlugins():

Plugin to remove Fully qualified class name
AbstractProductsProductReviewsResourceRoutePlugin Spryker\Glue\ProductReviewsRestApi\Plugin\GlueApplication\AbstractProductsProductReviewsResourceRoutePlugin
Route plugin still active

In the Spryker Suite reference configuration, AbstractProductsProductReviewsResourceRoutePlugin has not yet been removed from GlueApplicationDependencyProvider. Remove it once you have verified your API Platform ProductReview endpoints are serving traffic correctly.

3. Regenerate transfers and API resources

docker/sdk cli console transfer:generate
docker/sdk cli glue api:generate
docker/sdk cli glue cache:clear

Relationship plugin status

Plugin Registered on resource Status Notes
ProductReviewsRelationshipByProductAbstractSkuPlugin abstract-products Remains This plugin is still registered and allows ?include=product-reviews on abstract product endpoints from the legacy Glue layer. Do not remove until ProductsRestApi is fully sunset.
ProductReviewsRelationshipByProductConcreteSkuPlugin concrete-products Removed Reviews on concrete products are now served directly via the API Platform ProductReview module.