Migrate ProductOfferPricesRestApi to API Platform

Edit on GitHub

This document describes how to migrate the ProductOfferPricesRestApi Glue module to the API Platform PriceProductOffer module.

Prerequisites

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

Migrating this module requires Migrate MerchantProductOffersRestApi to be completed first, as this module’s route endpoint was a sub-resource of product-offers.

Overview

The ProductOfferPricesRestApi module provided the following storefront endpoint:

Endpoint Operation Old plugin
GET /product-offers/{productOfferReference}/product-offer-prices Get product offer prices ProductOfferPricesResourceRoutePlugin

This is now served by the API Platform PriceProductOffer module.

1. Update module dependencies

composer require spryker/price-product-offer:"^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
ProductOfferPricesResourceRoutePlugin Spryker\Glue\ProductOfferPricesRestApi\Plugin\GlueApplication\ProductOfferPricesResourceRoutePlugin

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
ProductOfferPriceByProductOfferReferenceResourceRelationshipPlugin product-offers Removed The product-offers resource is now served by the API Platform MerchantProductOffer module.
ProductOfferPriceByProductOfferReferenceResourceRelationshipPlugin shopping-list-items Remains This plugin is still registered on shopping-list-items (from ShoppingListsRestApi). Do not remove until ShoppingListsRestApi is migrated.