Migrate CategoriesRestApi to API Platform

Edit on GitHub

This document describes how to migrate the CategoriesRestApi Glue module to the API Platform Category module.

Prerequisites

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

Overview

The CategoriesRestApi module provided the following storefront endpoints:

Endpoint Operation Old plugin
GET /category-trees Get category tree CategoriesResourceRoutePlugin
GET /category-nodes/{categoryNodeId} Get category node CategoryResourceRoutePlugin

These are now served by the API Platform Category module.

1. Update module dependencies

composer require spryker/category:"^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
CategoriesResourceRoutePlugin Spryker\Glue\CategoriesRestApi\Plugin\CategoriesResourceRoutePlugin
CategoryResourceRoutePlugin Spryker\Glue\CategoriesRestApi\Plugin\CategoryResourceRoutePlugin

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
AbstractProductsCategoriesResourceRelationshipPlugin (ProductsCategoriesResourceRelationship) Remains registered on the abstract-products resource for legacy Glue endpoints. Do not remove.