WorkflowMessageInterface
in
Table of Contents
Methods
- assertValid() : $this
- Assert that the current message data is valid/sufficient.
- export() : array<string|int, mixed>|null
- getFields() : array<string|int, FieldSpec>
- getLocale() : string|null
- Get the locale in use, if set.
- getWorkflowName() : string
- import() : $this
- Import values from some scope.
- renderTemplate() : array<string|int, mixed>
- Render a message template.
- sendTemplate() : array<string|int, mixed>
- Send an email using a message template.
- validate() : array<string|int, mixed>
- Determine if the data for this workflow message is complete/well-formed.
Methods
assertValid()
Assert that the current message data is valid/sufficient.
public
assertValid([bool $strict = FALSE ]) : $this
TIP: Do not implement directly. Use FinalHelperTrait.
Parameters
- $strict : bool = FALSE
-
If TRUE, then warnings will raise exceptions. If FALSE, then only errors will raise exceptions.
Tags
Return values
$thisexport()
public
export([string|null $format = NULL ]) : array<string|int, mixed>|null
Parameters
- $format : string|null = NULL
-
Ex: 'tplParams', 'tokenContext', 'modelProps', 'envelope'
Tags
Return values
array<string|int, mixed>|null —A list of field-values that are used in the given format, keyed by their name in that format. If the implementation does not understand a specific format, return NULL.
getFields()
public
getFields() : array<string|int, FieldSpec>
Return values
array<string|int, FieldSpec> —A list of field-specs that are used in the given format, keyed by their name in that format. If the implementation does not understand a specific format, return NULL.
getLocale()
Get the locale in use, if set.
public
getLocale() : string|null
Return values
string|nullgetWorkflowName()
public
getWorkflowName() : string
Return values
stringimport()
Import values from some scope.
public
import(string $format, array<string|int, mixed> $values) : $this
Ex: $message->import('tplParams', ['sm_art_stuff' => 123]);
Parameters
- $format : string
-
Ex: 'tplParams', 'tokenContext', 'modelProps', 'envelope'
- $values : array<string|int, mixed>
Tags
Return values
$thisrenderTemplate()
Render a message template.
public
renderTemplate([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
TIP: Do not implement directly. Use FinalHelperTrait.
Parameters
- $params : array<string|int, mixed> = []
-
Options for loading the message template. If none given, the default for this workflow will be loaded. Ex: ['messageTemplate' => ['msg_subject' => 'Hello {contact.first_name}']] Ex: ['messageTemplateID' => 123]
Tags
Return values
array<string|int, mixed> —Rendered message, consistent of 'subject', 'text', 'html' Ex: ['subject' => 'Hello Bob', 'text' => 'It's been so long since we sent you an automated notification!']
sendTemplate()
Send an email using a message template.
public
sendTemplate([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
TIP: Do not implement directly. Use FinalHelperTrait.
Parameters
- $params : array<string|int, mixed> = []
-
List of extra parameters to pass to
sendTemplate()
. Ex:- from
- toName
- toEmail
- cc
- bcc
- replyTo
- isTest
Tags
Return values
array<string|int, mixed> —Array of four parameters: a boolean whether the email was sent, and the subject, text and HTML templates
validate()
Determine if the data for this workflow message is complete/well-formed.
public
validate() : array<string|int, mixed>
Return values
array<string|int, mixed> —A list of errors and warnings. Each record defines
- severity: string, 'error' or 'warning'
- fields: string[], list of fields implicated in the error
- name: string, symbolic name of the error/warning
- message: string, printable message describing the problem