1. Go to this page and download the library: Download kitpages/workflow-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Kitpages\StepBundle\Step\StepEvent;
use Kitpages\WorkflowBundle\Step\AbstractWorkflowStep;
class MyStep extends AbstractWorkflowStep {
public function execute(StepEvent $event = null)
{
// get current workflow and action event
$workflow = $this->getWorkflow();
$actionEvent = $this->getActionEvent();
// extract data from actionEvent
$myValue1 = $actionEvent->get("myKey");
$myOtherValue = $actionEvent->get("myOtherKey");
// do someting
$logger = $this->getService("logger");
$logger->info("I write a log");
$urlStepParameter = $this->getParameter("url");
// record some values in the workflow object
$workflow->set("resultKey", "value calculated");
if ($someResult == true) {
return "ok";
} else {
return "false";
}
}
}