legacy-publish-handler-bundle

UNIX name Owner Status
legacy-publish-handler-bundle eZ Ecosystem stable
Version Compatible with
N/A N/A
Bundle to handle content pre/post publish from LegacyBridge to Symfony

LegacyPublishHandlerBundle

Bundle to handle content pre/post publish from LegacyBridge to Symfony

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the
following command to download the latest stable version of this bundle:


$ composer require stevecohenfr/legacy-publish-handler-bundle:"*"

This command requires you to have Composer installed globally, as explained
in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php file of your project:


// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...

new SteveCohenFr\LegacyPublishHandlerBundle\SteveCohenFrLegacyPublishHandlerBundle(),
);

// ...
}

// ...
}

Deploy the legacy extension:

php bin/console ezpublish:legacybundles:install_extensions --relative

And clear the cache:

php bin/console cache:clear

Step 3: Create the workflow and trigger it

  • Go to Administration -> Workflows
  • Create a new workflow group or use "Standard"
  • Create a new Workflow process and name it as you want
  • In the dropdown choose "Legacy Publish Handler
  • Save
  • Go to Administration -> Triggers
  • At the line "content publish after" or "content publish before", use the dropdown to choose your previously created Worlflow

Step 4: Handle the publish event

This handler use the tag 'legacy.publish_handler' :

service.yml

services:
on_publish_handler:
class: ACME\ACMEBundle\Handlers\OnPublishHandler
tags:
- { name: stevecohenfr.legacy_publish_handler }

ACME\ACMEBundle\Handlers\OnPublishHandler.php

namespace ACME\ACMEBundle\Handlers;

use eZ\Publish\API\Repository\Values\Content\Content;
use SteveCohenFr\LegacyPublishHandlerBundle\Classes\LegacyPublishHandlerInterface;

class OnPublishHandler implements LegacyPublishHandlerInterface
{
/**
* This function is called from legacy part before an object publication (called by workflow)
* You must link the "before publish" trigger to the custom workflow
*
* @param Content $content The legacy object
* @param int $version The object version
*
*/
function beforePublish(Content $content, $version)
{
//TODO this function will be called before the content is published
}

/**
* This function is called from legacy part after an object publication (called by workflow)
* You must link the "after publish" trigger to the custom workflow
*
* @param Content $content The legacy object
* @param int $version The object version
*
*/
function afterPublish(Content $content, $version)
{
//TODO this function will be called after the content is published
}
}

No news yet.

This project has no reviews yet. Be the first one to review it!

No forum messages yet.