Documentation

ServiceConsumer extends ServiceCloudConsumer
in package

Predefined service cloud consumer for `ServiceTemplate` with all required middlewares registered.

Table of Contents

Properties

$dataSources  : array<string|int, AbstractDataSource>
Data sources.
$invalidatedThroughStorage  : mixed
See getter.
$invalidatedThroughStorageCurrentTransaction  : mixed
$middlewares  : array<string|int, AbstractMiddleware>
Middlewares.
$pools  : array<string|int, ConsumerPool>
Consumer pools.
$retrievingDataTransactionCount  : mixed
$storage  : AbstractStorage
Storage.
$templates  : array<string|int, AbstractTemplate>
In-memory cache of collected templates of all data sources.
$typeClass  : mixed
$variableResolver  : VariableResolver
VariableResolver.

Methods

__construct()  : mixed
C'tor.
addDataSource()  : mixed
Add data source to our consumer.
addMiddleware()  : mixed
Add middleware to our consumer.
addPool()  : mixed
Add new consumer pool.
getDataSources()  : mixed
Getter.
getMiddlewares()  : mixed
Getter.
getPools()  : mixed
Getter.
getStorage()  : mixed
Getter.
getTypeClass()  : mixed
Getter.
getVariableResolver()  : mixed
Getter.
isInvalidatedThroughStorage()  : mixed
Checks if the current `retrieve()`/`retrieveBy()` statement got invalidated through the storage.
retrieve()  : array<string|int, AbstractTemplate>
Get all template instances.
retrieveBy()  : array<string|int, AbstractTemplate>
Get a single template instance by criteria.
runMiddleware()  : mixed
Run a closure for each middleware type. This also respects `AbstractConsumerMiddleware`.
setStorage()  : mixed
Setter.
setVariableResolver()  : mixed
Setter.
downloadAndPersistFromDataSource()  : mixed
Download templates from data sources and persist to storage. This also respected the `ConsumerPool` if one given.
downloadFromDataSource()  : array<string|int, AbstractTemplate>
Download templates from data sources. This does not persist anything to the storage, for this use `downloadAndPersistFromDataSource` or `retrieve` instead!
filterTemplates()  : array<string|int, AbstractTemplate>
Remove unwanted classes from the templates array.

Properties

$invalidatedThroughStorageCurrentTransaction

private mixed $invalidatedThroughStorageCurrentTransaction = false

$middlewares

Middlewares.

private array<string|int, AbstractMiddleware> $middlewares = []

Methods

addMiddleware()

Add middleware to our consumer.

public addMiddleware(AbstractMiddleware $middleware) : mixed
Parameters
$middleware : AbstractMiddleware

getVariableResolver()

Getter.

public getVariableResolver() : mixed
Tags
codeCoverageIgnore

isInvalidatedThroughStorage()

Checks if the current `retrieve()`/`retrieveBy()` statement got invalidated through the storage.

public isInvalidatedThroughStorage([bool $includePools = true ]) : mixed

Use this within your middlewares so you can e.g. determine to fetch from an external source or not.

Parameters
$includePools : bool = true

If you run within a pool, it checks the other service cloud consumers within the pool, too

retrieve()

Get all template instances.

public retrieve([bool|string $forceInvalidate = false ]) : array<string|int, AbstractTemplate>
Parameters
$forceInvalidate : bool|string = false

Pass "never" to skip download from data source completely

Return values
array<string|int, AbstractTemplate>

retrieveBy()

Get a single template instance by criteria.

public retrieveBy(string $field, mixed $value[, bool|string $forceInvalidate = false ]) : array<string|int, AbstractTemplate>
Parameters
$field : string

Can be identifier or your custom implementation which is supported by your storage

$value : mixed
$forceInvalidate : bool|string = false

Pass "never" to skip download from data source completely

Return values
array<string|int, AbstractTemplate>

runMiddleware()

Run a closure for each middleware type. This also respects `AbstractConsumerMiddleware`.

public runMiddleware(string $middlewareTypeClass, callable $closure) : mixed
Parameters
$middlewareTypeClass : string
$closure : callable

        
On this page

Search results