Documentation

CFOWorkFlows
in package

Class to support CFO workflows

Table of Contents

Properties

$cfos  : CFOs
$cfoWorkFlows  : mixed
$core  : Core7
$error  : mixed
$errorCode  : mixed
$errorMsg  : mixed
$logs  : array<string|int, mixed>
$messages  : array<string|int, mixed>
$version  : mixed
$workFlows  : WorkFlows

Methods

__construct()  : mixed
DataSQL constructor.
addError()  : bool
Add an error in the class
process()  : bool
Process the event and update the logs
evaluateCondition()  : bool
Evaluate the condition of a given workflow
evaluateWorkflow()  : void
Evaluate the workflow action and perform the corresponding action
hook()  : true|void|null
Process Hook in $workflow
insertCFOData()  : bool|void|null
Process $workflow to insert a record in a CFO
mergeExternalWorkFlows()  : bool
Merge external workflows into the given array of workflows.
processWorkFlowMessage()  : void
Process the workflow message and update the relevant variables and reports
readRelations()  : bool
Process $workflow to insert a record in a CFO
searchModel()  : array<string|int, mixed>|null
Search for a model object
sendEmail()  : void
Process $workflow to send emails
setLocalizationLang()  : true|void|null
Process $workflow to insert a record in a CFO
setVariables()  : true|void|null
Process $workflow to set variables in the data model
updateCFOData()  : bool|void|null
Process $workflow to update a record in a CFO
workflows_report()  : void
Add a workflow report

Properties

$cfoWorkFlows

public mixed $cfoWorkFlows = []

$core

public Core7 $core

$error

public mixed $error = \false

$errorCode

public mixed $errorCode = \null

$errorMsg

public mixed $errorMsg = []

$logs

public array<string|int, mixed> $logs = []

to report Workflow results

$messages

public array<string|int, mixed> $messages = []

included on workflows

$version

public mixed $version = '202408081'

Methods

__construct()

DataSQL constructor.

public __construct(Core &$core, mixed &$cfos) : mixed
Parameters
$core : Core
$cfos : mixed

addError()

Add an error in the class

public addError(string $code, mixed $value) : bool
Parameters
$code : string

Code of error

$value : mixed
Return values
bool

Always return null to facilitate other return functions

process()

Process the event and update the logs

public process(string $event, array<string|int, mixed> &$data, mixed $id[, string $cfo = '' ]) : bool
Parameters
$event : string

The event to be processed

$data : array<string|int, mixed>

The data to be processed

$id : mixed

value of $data array

$cfo : string = ''

The CFO used with $data. If empty it takes $this->cfos->last_cfo

Return values
bool

return true on success and false on error

evaluateCondition()

Evaluate the condition of a given workflow

private evaluateCondition(array<string|int, mixed> &$workflow, array<string|int, mixed> &$data, string $event, int $_i) : bool
Parameters
$workflow : array<string|int, mixed>

The workflow to evaluate

$data : array<string|int, mixed>

The data used in the evaluation

$event : string

The event name

$_i : int

The index of the workflow

Return values
bool

The result of the condition evaluation. Returns true if the condition is met, false otherwise.

evaluateWorkflow()

Evaluate the workflow action and perform the corresponding action

private evaluateWorkflow(array<string|int, mixed> &$workflow, mixed &$data, int $id, string $event, int $_i, mixed $cfo) : void
Parameters
$workflow : array<string|int, mixed>

The workflow data

$data : mixed

The data to be processed

$id : int

The ID of the workflow

$event : string

The event trigger

$_i : int

Index parameter

$cfo : mixed

CFO parameter

hook()

Process Hook in $workflow

private hook(array<string|int, mixed> &$workflow, array<string|int, mixed> &$data,  $_i,  $hook_type) : true|void|null
Parameters
$workflow : array<string|int, mixed>
$data : array<string|int, mixed>
$_i :
$hook_type :
Return values
true|void|null

insertCFOData()

Process $workflow to insert a record in a CFO

private insertCFOData(array<string|int, mixed> &$workflow, array<string|int, mixed> &$data,  $_i) : bool|void|null
Parameters
$workflow : array<string|int, mixed>
$data : array<string|int, mixed>
$_i :
Return values
bool|void|null

mergeExternalWorkFlows()

Merge external workflows into the given array of workflows.

private mergeExternalWorkFlows(array<string|int, mixed> &$workFlows, string $external_workflow_id) : bool
Parameters
$workFlows : array<string|int, mixed>

The array of workflows to merge into (passed by reference).

$external_workflow_id : string

The ID of the external workflow.

Return values
bool

Returns true on success, false on error.

processWorkFlowMessage()

Process the workflow message and update the relevant variables and reports

private processWorkFlowMessage(array<string|int, mixed> &$workflow, array<string|int, mixed> &$data) : void
Parameters
$workflow : array<string|int, mixed>

The workflow array containing the message information

$data : array<string|int, mixed>

The data array containing the variables for replacement

readRelations()

Process $workflow to insert a record in a CFO

private readRelations(array<string|int, mixed> &$workflow, array<string|int, mixed> &$data,  $_i) : bool
Parameters
$workflow : array<string|int, mixed>
$data : array<string|int, mixed>
$_i :
Return values
bool

searchModel()

Search for a model object

private searchModel(string $object) : array<string|int, mixed>|null
Parameters
$object : string

The object to search for

Return values
array<string|int, mixed>|null

Returns the model object if found, otherwise returns null

sendEmail()

Process $workflow to send emails

private sendEmail(array<string|int, mixed> &$workflow, array<string|int, mixed> &$data, string &$id, string $cfo,  $_i,  $hook_type) : void
Parameters
$workflow : array<string|int, mixed>
$data : array<string|int, mixed>
$id : string
$cfo : string
$_i :
$hook_type :
Tags
throws
Mandrill_Error

setLocalizationLang()

Process $workflow to insert a record in a CFO

private setLocalizationLang(array<string|int, mixed> &$workflow, array<string|int, mixed> &$data,  $_i) : true|void|null
Parameters
$workflow : array<string|int, mixed>
$data : array<string|int, mixed>
$_i :
Return values
true|void|null

setVariables()

Process $workflow to set variables in the data model

private setVariables(array<string|int, mixed> &$workflow, array<string|int, mixed> &$data,  $_i) : true|void|null
Parameters
$workflow : array<string|int, mixed>
$data : array<string|int, mixed>
$_i :
Return values
true|void|null

updateCFOData()

Process $workflow to update a record in a CFO

private updateCFOData(array<string|int, mixed> &$workflow, array<string|int, mixed> &$data,  $_i) : bool|void|null
Parameters
$workflow : array<string|int, mixed>
$data : array<string|int, mixed>
$_i :
Return values
bool|void|null

workflows_report()

Add a workflow report

private workflows_report(mixed $key,  $message) : void
Parameters
$key : mixed
$message :

        
On this page

Search results