Migrate AlternativeProductsRestApi to API Platform
Edit on GitHubThis document describes how to migrate the AlternativeProductsRestApi Glue module to the API Platform ProductAlternative module.
Prerequisites
Complete the cross-cutting changes described in Migrate Glue REST API to API Platform before proceeding.
Overview
The AlternativeProductsRestApi module provided the following storefront endpoints:
| Endpoint | Operation | Old plugin |
|---|---|---|
GET /concrete-products/{sku}/abstract-alternative-products |
Get abstract alternative products | AbstractAlternativeProductsResourceRoutePlugin |
GET /concrete-products/{sku}/concrete-alternative-products |
Get concrete alternative products | ConcreteAlternativeProductsResourceRoutePlugin |
These are now served by the API Platform ProductAlternative module.
1. Update module dependencies
composer require spryker/product-alternative:"^X.Y.Z"
Use the version that includes the API Platform resources. Check the module changelog for the exact version.
2. Remove route plugins from GlueApplicationDependencyProvider
In src/Pyz/Glue/GlueApplication/GlueApplicationDependencyProvider.php, remove the following plugins from getResourceRoutePlugins():
| Plugin to remove | Fully qualified class name |
|---|---|
AbstractAlternativeProductsResourceRoutePlugin |
Spryker\Glue\AlternativeProductsRestApi\Plugin\GlueApplication\AbstractAlternativeProductsResourceRoutePlugin |
ConcreteAlternativeProductsResourceRoutePlugin |
Spryker\Glue\AlternativeProductsRestApi\Plugin\GlueApplication\ConcreteAlternativeProductsResourceRoutePlugin |
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
The AlternativeProductsRestApi module did not register any relationship plugins. No relationship changes are needed.
Thank you!
For submitting the form