Loader
in package
implements
LoggerAwareInterface
Uses
LoggerAwareTrait
Record loader
Tags
Interfaces, Classes, Traits and Enums
- LoggerAwareInterface
Table of Contents
- $fallbackLoader : PluginManager
- Fallback record loader
- $recordCache : Cache
- Record cache
- $recordFactory : PluginManager
- Record factory
- $searchService : Service
- Search service
- __construct() : mixed
- Constructor
- load() : AbstractBase
- Given an ID and record source, load the requested record object.
- loadBatch() : array<string|int, mixed>
- Given an array of associative arrays with id and source keys (or pipe- separated source|id strings), load all of the requested records in the requested order.
- loadBatchForSource() : array<string|int, mixed>
- Given an array of IDs and a record source, load a batch of records for that source.
- setCacheContext() : void
- Set the context to control cache behavior
- buildMissingRecord() : Missing
- Build a "missing record" driver.
- debug() : void
- Log a debug message.
- log() : void
- Send a message to the logger.
- logError() : void
- Log an error message.
- logWarning() : void
- Log a warning message.
Properties
$fallbackLoader
Fallback record loader
protected
PluginManager
$fallbackLoader
$recordCache
Record cache
protected
Cache
$recordCache
$recordFactory
Record factory
protected
PluginManager
$recordFactory
$searchService
Search service
protected
Service
$searchService
Methods
__construct()
Constructor
public
__construct(Service $searchService, PluginManager $recordFactory[, Cache $recordCache = null ][, PluginManager $fallbackLoader = null ]) : mixed
Parameters
- $searchService : Service
-
Search service
- $recordFactory : PluginManager
-
Record loader
- $recordCache : Cache = null
-
Record Cache
- $fallbackLoader : PluginManager = null
-
Fallback record loader
Return values
mixed —load()
Given an ID and record source, load the requested record object.
public
load(string $id[, string $source = DEFAULT_SEARCH_BACKEND ][, bool $tolerateMissing = false ][, ParamBag $params = null ]) : AbstractBase
Parameters
- $id : string
-
Record ID
- $source : string = DEFAULT_SEARCH_BACKEND
-
Record source
- $tolerateMissing : bool = false
-
Should we load a "Missing" placeholder instead of throwing an exception if the record cannot be found?
- $params : ParamBag = null
-
Search backend parameters
Tags
Return values
AbstractBase —loadBatch()
Given an array of associative arrays with id and source keys (or pipe- separated source|id strings), load all of the requested records in the requested order.
public
loadBatch(array<string|int, mixed> $ids[, bool $tolerateBackendExceptions = false ][, array<string|int, ParamBag> $params = [] ]) : array<string|int, mixed>
Parameters
- $ids : array<string|int, mixed>
-
Array of associative arrays with id/source keys or strings in source|id format. In associative array formats, there is also an optional "extra_fields" key which can be used to pass in data formatted as if it belongs to the Solr schema; this is used to create a mock driver object if the real data source is unavailable.
- $tolerateBackendExceptions : bool = false
-
Whether to tolerate backend exceptions that may be caused by e.g. connection issues or changes in subscriptions
- $params : array<string|int, ParamBag> = []
-
Associative array of search backend parameters keyed with source key
Tags
Return values
array<string|int, mixed> —Array of record drivers
loadBatchForSource()
Given an array of IDs and a record source, load a batch of records for that source.
public
loadBatchForSource(array<string|int, mixed> $ids[, string $source = DEFAULT_SEARCH_BACKEND ][, bool $tolerateBackendExceptions = false ][, ParamBag $params = null ]) : array<string|int, mixed>
Parameters
- $ids : array<string|int, mixed>
-
Record IDs
- $source : string = DEFAULT_SEARCH_BACKEND
-
Record source
- $tolerateBackendExceptions : bool = false
-
Whether to tolerate backend exceptions that may be caused by e.g. connection issues or changes in subscriptions
- $params : ParamBag = null
-
Search backend parameters
Tags
Return values
array<string|int, mixed> —setCacheContext()
Set the context to control cache behavior
public
setCacheContext(string $context) : void
Parameters
- $context : string
-
Cache context
Return values
void —buildMissingRecord()
Build a "missing record" driver.
protected
buildMissingRecord(array<string|int, mixed> $details) : Missing
Parameters
- $details : array<string|int, mixed>
-
Associative array of record details (from a SourceAndIdList)
Return values
Missing —debug()
Log a debug message.
protected
debug(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?
Return values
void —log()
Send a message to the logger.
protected
log(string $level, string $message[, array<string|int, mixed> $context = [] ][, bool $prependClass = false ]) : void
Parameters
- $level : string
-
Log level
- $message : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = false
-
Prepend class name to message?
Return values
void —logError()
Log an error message.
protected
logError(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?
Return values
void —logWarning()
Log a warning message.
protected
logWarning(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?