Migrate ProductOfferAvailabilitiesRestApi to API Platform

Edit on GitHub

This document describes how to migrate the ProductOfferAvailabilitiesRestApi Glue module to the API Platform ProductOfferAvailability 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 ProductOfferAvailabilitiesRestApi module provided the following storefront endpoint:

Endpoint Operation Old plugin
GET /product-offers/{productOfferReference}/product-offer-availabilities Get product offer availability ProductOfferAvailabilitiesResourceRoutePlugin

This is now served by the API Platform ProductOfferAvailability module.

1. Update module dependencies

composer require spryker/product-offer-availability:"^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
ProductOfferAvailabilitiesResourceRoutePlugin Spryker\Glue\ProductOfferAvailabilitiesRestApi\Plugin\GlueApplication\ProductOfferAvailabilitiesResourceRoutePlugin

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