Skip to the content
Documentation

How-to trigger a workflow using the Public API: compariso...

No ratings yet

Versions Compared

Old Version 4

changes.mady.by.user Bertrand Dunogier

Saved on May 23, 2013

compared with

New Version 5

changes.mady.by.user Bertrand Dunogier

Saved on May 23, 2013

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
language php
/**
 * Returns the legacy kernel object.
 *
 * @return \eZ\Publish\Core\MVC\Legacy\Kernel
 */
protected function getLegacyKernel()
{
    $closure = $this->getContainer()->get( 'exponential_legacy.kernel' );
    return $closure();
}

Then, you need to use this legacy kernel the object to run a Legacy Kernel Callback (e.g. code fragment).

...

The code above takes a contentId (object ID), and a version number as the argument, and runs the content/publish operation on it. It then returns true if the operation ended successfully, or false if it was aborted by the workflow engine (or if it failed, but it can be improved).

Test script

The code below is a working Command script example that demonstrates the workaround. Just drop it in a bundle and update the namespace: https://gist.github.com/bdunogier/e05ed564770fa6a51e51

Comments

Add a comment

Comments are read by a moderator before they appear.