WorkflowTemplate
class WorkflowTemplate (View source)
A class that wraps around an array description of a workflow
array( 'Step Name' = array( 'type' => class name 'transitions' => array( 'transition name' => 'target step', 'next name' => 'other step' ) ), 'Next Step' = array(
), )
This can be defined in config yml as follows
Injector: SimpleReviewApprove: class: WorkflowTemplate constructor:
- Review and Approve
- Description of the workflow template
- 0.1 (version number)
properties:
structure:
Apply for approval:
type: AssignUsersToWorkflowAction
transitions:
notify: Notify users
Notify users:
type: NotifyUsersWorkflowAction
transitions:
approval: Approval
Approval:
type: SimpleApprovalWorkflowAction
transitions:
Approve: Publish
Reject: Reject
Publish:
type: PublishItemWorkflowAction
Reject:
type: CancelWorkflowAction
WorkflowService:
properties:
templates:
- %$SimpleReviewApprove
When updating a template, there's a few things that can be done to assist the system when changing things around
- Update the 'version' number
Properties
protected | $name | |||
protected | $description | |||
protected | $version | |||
protected | $remindDays | |||
protected | $sort | |||
protected | array | $structure | An array representation of the structure of this workflow template |
Methods
No description
Creates the relevant data objects for this structure, returning an array of actions in the order they've been created
Create a workflow action based on a template
Create a WorkflowDefinition->Users relation based on template data. But only if the related groups from the export, can be foud in the target environment's DB.
Create a WorkflowDefinition->Groups relation based on template data, But only if the related groups from the export, can be foud in the target environment's DB.
Update the transitions for a given action
Given an object, first check it has a ManyMany relation on it and add() Member and Group relations as required.
Details
__construct($name, $description = '', $version = '0.0', $remindDays = 0, $sort = 0)
No description
getName()
No description
getVersion()
No description
getDescription()
No description
getRemindDays()
No description
getSort()
No description
setStructure(array $structure)
Set the structure for this template
array
createRelations($definition = null)
Creates the relevant data objects for this structure, returning an array of actions in the order they've been created
protected WorkflowAction
createAction(string $name, $actionTemplate, WorkflowDefinition $definition = null)
Create a workflow action based on a template
protected void
createUsers(array $users, WorkflowDefinition $definition, bool $clear = false)
Create a WorkflowDefinition->Users relation based on template data. But only if the related groups from the export, can be foud in the target environment's DB.
Note: The template gives us a Member Email to work with rather than an ID as it's arguably more likely that Member Emails will be the same between environments than their IDs.
protected void
createGroups(array $groups, WorkflowDefinition $definition, bool $clear = false)
Create a WorkflowDefinition->Groups relation based on template data, But only if the related groups from the export, can be foud in the target environment's DB.
Note: The template gives us a Group Title to work with rther than an ID as it's arguably more likely that Group titles will be the same between environments than their IDs.
protected array
updateActionTransitions(array $actionTemplate, WorkflowAction $action)
Update the transitions for a given action
updateDefinition(WorkflowDefinition $definition)
Update a workflow definition
protected void
addManyManyToObject(object $object, array $source, bool $clear = false)
Given an object, first check it has a ManyMany relation on it and add() Member and Group relations as required.