Glue API - Category management feature integration

Edit on GitHub
You are browsing a previous version of the document. The latest version is 202212.0.

Install feature API

Prerequisites

To start feature integration, overview and install the necessary features:

Name Version Integration guide
Spryker Core 202009.0 Glue Application feature integration
Category Management 202009.0

1) Install the required modules using Composer

Run the following command to install the required modules:

composer require spryker/categories-rest-api:"^1.1.3" --update-with-dependencies
“Verification”

Make sure that the following module is installed:

Module Expected directory
CategoriesRestApi vendor/spryker/categories-rest-api

2) Set Up Transfer Objects

Run the following command to generate transfer changes:

console transfer:generate
“Verification”

Make sure that the following changes have occurred:

Transfer Type Event Path
RestCategoryTreesTransfer class created src/Generated/Shared/Transfer/RestCategoryTreesTransfer
RestCategoryTreesAttributesTransfer class created src/Generated/Shared/Transfer/RestCategoryTreesAttributesTransfer
RestCategoryNodesAttributesTransfer class created src/Generated/Shared/Transfer/RestCategoryNodesAttributesTransfer

3) Set Up Behavior

Enable resources and relationships:

Activate the following plugins:

Plugin Specification Prerequisites Namespace
CategoriesResourceRoutePlugin Registers the category-tree resource. None Spryker\Glue\CategoriesRestApi\Plugin
CategoryResourceRoutePlugin Registers the category-nodes resource. None Spryker\Glue\CategoriesRestApi\Plugin

src/Pyz/Glue/GlueApplication/GlueApplicationDependencyProvider.php

<?php

namespace Pyz\Glue\GlueApplication;

use Spryker\Glue\CategoriesRestApi\Plugin\CategoriesResourceRoutePlugin;
use Spryker\Glue\CategoriesRestApi\Plugin\CategoryResourceRoutePlugin;
use Spryker\Glue\GlueApplication\GlueApplicationDependencyProvider as SprykerGlueApplicationDependencyProvider;

class GlueApplicationDependencyProvider extends SprykerGlueApplicationDependencyProvider
{
    /**
     * @return \Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ResourceRoutePluginInterface[]
     */
    protected function getResourceRoutePlugins(): array
    {
        return [
            new CategoriesResourceRoutePlugin(),
            new CategoryResourceRoutePlugin(),
        ];
    }
}