Migrate ProductOptionsRestApi to API Platform

Edit on GitHub

This document describes how to migrate the ProductOptionsRestApi Glue module to the API Platform ProductOption module.

Prerequisites

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

Overview

The ProductOptionsRestApi module did not add a standalone resource route. It contributed relationship plugins that attached product option data to product resources.

These relationships are now handled by the API Platform ProductOption module.

1. Update module dependencies

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

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

2. Remove relationship plugin from GlueApplicationDependencyProvider

In the getResourceRelationshipPlugins() method, remove the following relationship registration:

Resource Plugin to remove Fully qualified class name
concrete-products ProductOptionsByProductConcreteSkuResourceRelationshipPlugin Spryker\Glue\ProductOptionsRestApi\Plugin\GlueApplication\ProductOptionsByProductConcreteSkuResourceRelationshipPlugin

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
ProductOptionsByProductConcreteSkuResourceRelationshipPlugin concrete-products Removed Product options for concrete products are now included via the API Platform ProductOption module.
ProductOptionsByProductAbstractSkuResourceRelationshipPlugin abstract-products Remains This plugin is still registered on abstract-products in the legacy Glue layer. Do not remove until ProductsRestApi is fully sunset from the legacy layer.