Migrate ProductPricesRestApi to API Platform

Edit on GitHub

This document describes how to migrate the ProductPricesRestApi Glue module to the API Platform PriceProduct module.

Prerequisites

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

Overview

The ProductPricesRestApi module provided the following storefront endpoints:

Endpoint Operation Old plugin
GET /abstract-products/{abstractProductSku}/abstract-product-prices Get abstract product prices AbstractProductPricesRoutePlugin
GET /concrete-products/{concreteProductSku}/concrete-product-prices Get concrete product prices ConcreteProductPricesRoutePlugin

These are now served by the API Platform PriceProduct module.

1. Update module dependencies

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

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
AbstractProductPricesRoutePlugin Spryker\Glue\ProductPricesRestApi\Plugin\AbstractProductPricesRoutePlugin
ConcreteProductPricesRoutePlugin Spryker\Glue\ProductPricesRestApi\Plugin\ConcreteProductPricesRoutePlugin

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 Status
AbstractProductPricesByResourceIdResourceRelationshipPlugin (ProductPricesRestApi) Removed from top-level abstract-products. Remains re-added in the grouped block for related-products and upselling-products legacy Glue endpoints. Do not remove that re-added registration.
ConcreteProductPricesByResourceIdResourceRelationshipPlugin (ProductPricesRestApi) Removed from top-level concrete-products. Remains re-added in the grouped block for legacy Glue sub-includes (wishlists, configurable bundles). Do not remove that re-added registration.