Install the Spryker Core Back Office + Comments feature

Edit on GitHub

This document describes how to install the Comments + Spryker Core Back Office feature.

Prerequisites

Install the required features:

NAME VERSION INSTALLATION GUIDE
Comments 202404.0 Install the Comments feature
Spryker Core Back Office 202404.0 Install the Spryker Core Back Office feature

1) Install the required modules

Install the required modules using Composer:

composer require spryker/comment-user-connector: "^1.0.0" --update-with-dependencies
Verification

Make sure the following modules have been installed:

MODULE EXPECTED DIRECTORY
CommentUserConnector vendor/spryker/comment-user-connector

3) Set up database schema and transfer objects

Apply database changes and generate entity and transfer changes:

console propel:install
console transfer:generate
Verification

Make sure the following changes have been applied in the database:

DATABASE ENTITY TYPE EVENT
spy_comment.fk_user column created
Verification

Make sure the following changes have been applied in transfer objects:

Transfer Type Event Path
Comment.fkUser property created src/Generated/Shared/Transfer/CommentTransfer
Comment.user property created src/Generated/Shared/Transfer/CommentTransfer

3) Set up behavior

Enable the following behaviors by registering the plugins:

PLUGIN SPECIFICATION PREREQUISITES NAMESPACE
UserCommentAuthorValidationStrategyPlugin Validates a comment author when CommentTransfer.fkUser is provided. Spryker\Zed\CommentUserConnector\Communication\Plugin\Comment
UserCommentExpanderPlugin Expands CommentTransfer with UserTransfer if CommentTransfer.fkUser is set. Spryker\Zed\CommentUserConnector\Communication\Plugin\Comment

src/Pyz/Zed/Comment/CommentDependencyProvider.php

<?php

namespace Pyz\Zed\Comment;

use Spryker\Zed\Comment\CommentDependencyProvider as SprykerCommentDependencyProvider;
use Spryker\Zed\CommentUserConnector\Communication\Plugin\Comment\UserCommentAuthorValidationStrategyPlugin;
use Spryker\Zed\CommentUserConnector\Communication\Plugin\Comment\UserCommentExpanderPlugin;

class CommentDependencyProvider extends SprykerCommentDependencyProvider
{
    /**
     * @return list<\Spryker\Zed\CommentExtension\Dependency\Plugin\CommentAuthorValidatorStrategyPluginInterface>
     */
    protected function getCommentAuthorValidatorStrategyPlugins(): array
    {
        return [
            new UserCommentAuthorValidationStrategyPlugin(),
        ];
    }

    /**
     * @return list<\Spryker\Zed\CommentExtension\Dependency\Plugin\CommentExpanderPluginInterface>
     */
    protected function getCommentExpanderPlugins(): array
    {
        return [
            new UserCommentExpanderPlugin(),
        ];
    }
}
Verification
  1. In the Back Office, go to Marketplace > Merchant Relations.
  2. Click Edit next to a merchant relation.
  3. Write a comment and click Save. Make sure the user’s information is displayed under the saved comment.