Element structure
less than a minute
The WorkflowElements are located in the app/Workflow/Elements/
Actions:
This Workflow type interacts with external components like the database or the client.
Api:
To get data from a external api.
Event:
Just the Events.
Flow:
Workflow elements used to manipulate the flow of the workflow.
Operator:
These elements manipulate the data passed in.
Query:
To get data from the database by building querys.
Source:
Everything to work with resources.
Example element:
/**
* Html to be displayed in the bakery
*/
class WorkflowActionExample extends WorkflowAction
{
# options displayed in the bakery
public function init() : void
{
parent::init();
$this->addOption(new WorkflowOptionText('key', 'label', 'default'));
}
# the actual code executed when the element is called
public function run() : void
{
$in = $this->getIn('port'); #default is default
$toOption = $this->getOption('to');
$requiredOption = $this->requireOption('option_name'); # this throws a WorkflowOptionRequiredException when the option is not set
# do something
$in = $this->doSomething($in);
# sending
$this->setOut('port', $in); # $value default is null
$this->runOut(); # release the element
}
}
To finally use the new Element add it to the getInlineMorphTypes()
in the app\Workflow\WorkflowElement
.