Documentation

PersistTranslationsMiddleware extends AbstractPoolMiddleware
in package

AbstractYes

Pool middleware for both service and blocker templates to persist translations into a dedicated cache / database.

Table of Contents

Constants

EXPAND_SKIP_KEYS  = ['language', 'identifier', 'successorOfIdentifierInfo', 'enabledWhenOneOf', 'recommendedWhenOneOf', 'extendsIdentifier', 'status', 'createdAt', 'tier', 'logoUrl', 'consumerData', 'serviceTemplateIdentifiers', 'ruleGroups', 'rules', 'ruleNotice', 'visualType', 'visualContentType', 'shouldUncheckContentBlockerCheckboxWhenOneOf', 'codeOptIn', 'codeOptOut', 'codeOnPageLoad', 'tagManagerOptInEventName', 'tagManagerOptOutEventName', 'dynamicFields', 'dataProcessingInCountries', 'dataProcessingInCountriesSpecialTreatments', 'legalBasis', 'legalBasisNotice', 'group', 'technicalHandlingNotice', 'createContentBlockerNotice', 'groupNotice', 'providerNotice']
Never create translations for this string-values.
PERSIST_CHUNK_SIZE  = 20

Properties

$consumer  : mixed
$suspended  : mixed

Methods

__construct()  : mixed
C'tor.
afterPersistTemplatesWithinPool()  : void
After persisting all template instances within a pool.
beforePersistTemplateWithinPool()  : void
Before persisting the template instance when all consumers within a pool got downloaded.
extractTranslations()  : array<string|int, Translation>
Extract translation instances from a set of templates.
fetchEnglishTemplates()  : mixed
Fetch english templates as they should not be persisted to database.
getConsumer()  : mixed
Getter.
getVariableResolver()  : mixed
Getter.
isSuspended()  : mixed
Check if the middleware is suspended.
persistTranslations()  : mixed
Persist translations to your database or object cache or whatever.
suspend()  : mixed
Allows to suspend or resume the middleware to take effect. This is efficient if a middleware could be called recursively.

Constants

EXPAND_SKIP_KEYS

Never create translations for this string-values.

public mixed EXPAND_SKIP_KEYS = ['language', 'identifier', 'successorOfIdentifierInfo', 'enabledWhenOneOf', 'recommendedWhenOneOf', 'extendsIdentifier', 'status', 'createdAt', 'tier', 'logoUrl', 'consumerData', 'serviceTemplateIdentifiers', 'ruleGroups', 'rules', 'ruleNotice', 'visualType', 'visualContentType', 'shouldUncheckContentBlockerCheckboxWhenOneOf', 'codeOptIn', 'codeOptOut', 'codeOnPageLoad', 'tagManagerOptInEventName', 'tagManagerOptOutEventName', 'dynamicFields', 'dataProcessingInCountries', 'dataProcessingInCountriesSpecialTreatments', 'legalBasis', 'legalBasisNotice', 'group', 'technicalHandlingNotice', 'createContentBlockerNotice', 'groupNotice', 'providerNotice']

Properties

Methods

afterPersistTemplatesWithinPool()

After persisting all template instances within a pool.

public afterPersistTemplatesWithinPool(mixed $consumers, mixed &$typeClassToAllTemplates) : void
Parameters
$consumers : mixed
$typeClassToAllTemplates : mixed

Key = type class, value = array of templates

beforePersistTemplateWithinPool()

Before persisting the template instance when all consumers within a pool got downloaded.

public beforePersistTemplateWithinPool(mixed $template, mixed &$typeClassToAllTemplates) : void

Example: Calculate contentBlockerTemplates for ServiceTemplate.

Parameters
$template : mixed
$typeClassToAllTemplates : mixed

Key = type class, value = array of templates

fetchEnglishTemplates()

Fetch english templates as they should not be persisted to database.

public abstract fetchEnglishTemplates(array<string|int, string> $identifiers, ServiceCloudConsumer $consumer) : mixed
Parameters
$identifiers : array<string|int, string>

List of identifiers for which we want to the english templates

$consumer : ServiceCloudConsumer

getVariableResolver()

Getter.

public getVariableResolver() : mixed
Tags
codeCoverageIgnore

isSuspended()

Check if the middleware is suspended.

public isSuspended() : mixed

suspend()

Allows to suspend or resume the middleware to take effect. This is efficient if a middleware could be called recursively.

public suspend(bool $state) : mixed
Parameters
$state : bool

        
On this page

Search results