Glue API - Wishlist 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 201903.0 Glue Application feature integration
Product 201903.0 Product API feature integration
Wishlist 201903.0

1) Install the required modules using Composer

Run the following command to install the required modules:

composer require spryker/wishlists-rest-api:"^1.3.0" spryker/wishlist-items-products-resource-relationship:"^1.0.0" --update-with-dependencies
Make sure that the following modules are installed:
Module Expected directory
WishlistsRestApi vendor/spryker/wishlists-rest-apiWishlistItems
ProductsResourceRelationship vendor/spryker/wishlist-items-products-resource-relationship

2) Set Up Database Schema and Transfer Objects

Run the following commands to apply database changes, and also generate entity and transfer changes:

console transfer:generate
console propel:install
console transfer:generate
Make sure that the following changes have occurred in the database:
Database entity Type Event
spy_wishlist.uuid column added
Make sure that the following changes have occurred in transfer objects:
Transfer Type Event Path
RestWishlistItemsAttributesTransfer class created src/Generated/Shared/Transfer/RestWishlistItemsAttributesTransfer
RestWishlistsAttributesTransfer class created src/Generated/Shared/Transfer/RestWishlistsAttributesTransfer
WishlistTransfer.uuid property added src/Generated/Shared/Transfer/WishlistTransfer

3) Set Up Behavior

Enable console command

Activate the console command provided by the module:

Class Specification Prerequisites Namespace
WishlistsUuidWriterConsole Provides the wishlists:uuid:update console command for generating UUIDs for existing spy_wishlist records. None Spryker\Zed\WishlistsRestApi\Communication\Console
src/Pyz/Zed/Console/ConsoleDependencyProvider.php
<?php

namespace Pyz\Zed\Console;

use Spryker\Zed\Console\ConsoleDependencyProvider as SprykerConsoleDependencyProvider;
use Spryker\Zed\Kernel\Container;
use Spryker\Zed\WishlistsRestApi\Communication\Console\WishlistsUuidWriterConsole;

class ConsoleDependencyProvider extends SprykerConsoleDependencyProvider
{
    /**
     * @param \Spryker\Zed\Kernel\Container $container
     *
     * @return \Symfony\Component\Console\Command\Command[]
     */
    protected function getConsoleCommands(Container $container)
    {
        $commands = [
            new WishlistsUuidWriterConsole(),
        ];
        return $commands;
    }
}

“Verification”

Run the following console command:
console list
Make sure that wishlists:uuid:update appears in the list.

Migrate data in the database

The following steps generate UUIDs for existing entities in the `spy_wishlist` table.

Run the following command:

console wishlists:uuid:update

(Make sure that the following endpoints are available:
http:///glue.mysprykershop.com/wishlists
http:///glue.mysprykershop.com/wishlists/{{wishlist_id}}/wishlists-items
Make a request to https://glue.mysprykershop.com/wishlists/{{wishlist_id}}/wishlists-items?include=concrete-products and make sure that the given wishlist has at least one product added.
Make sure that the response includes relationships to the concrete-products resources.)

“Verification”

Make a request to https://glue.mysprykershop.com/customers/{{customer_id}}?include=wishlists and make sure that the given customer has at least one wishlist.
Make sure that the response includes relationships to the wishlists resources.

See also:

Last review date: Apr 11, 2019