DocumentCoreFactory
in package
Uses
Extensible, Configurable, LoggerTrait
Class DocumentFactory Factory to create documents to be pushed to Solr
Table of Contents
Properties
- $class : string
- $debug : bool
- Set debug mode on or off
- $fieldResolver : FieldResolver
- $items : SS_List
- $keyService : UniqueKeyInterface
- $logger : LoggerInterface
- The logger to use
Methods
- __construct() : mixed
- DocumentFactory constructor, sets up the field resolver
- buildItems() : array<string|int, mixed>
- Note, it can only take one type of class at a time! So make sure you properly loop and set $class
- getClass() : string
- getFieldResolver() : mixed|object|Injector
- getItems() : mixed
- getLogger() : LoggerInterface
- Get the logger
- isDebug() : bool
- Are we debugging?
- setClass() : void
- setDebug() : DocumentCoreFactory
- Set to true if debugging should be enabled
- setFieldResolver() : void
- setItems() : void
- setLogger() : void
- Set the logger if needed
- addDefaultFields() : mixed
- classEquals() : bool
- Check if a base class is an instance of the expected base group
- classIs() : bool
- Determine if the given object is one of the given type
- getShortFieldName() : mixed
- getValuesForField() : array<string|int, mixed>
- Use the DataResolver to find the value(s) for a field.
- indexGroupMessage() : void
- Show the message about what is being indexed
Properties
$class
protected
string
$class
Name of the class being indexed
$debug
Set debug mode on or off
protected
bool
$debug
$fieldResolver
protected
FieldResolver
$fieldResolver
$items
protected
SS_List
$items
Items that need to be manufactured into documents
$keyService
protected
UniqueKeyInterface
$keyService
$logger
The logger to use
protected
LoggerInterface
$logger
Methods
__construct()
DocumentFactory constructor, sets up the field resolver
public
__construct() : mixed
Tags
buildItems()
Note, it can only take one type of class at a time! So make sure you properly loop and set $class
public
abstract buildItems(array<string|int, mixed> $fields, BaseIndex $index[, mixed $update = null ]) : array<string|int, mixed>
Parameters
- $fields : array<string|int, mixed>
-
Fields to index
- $index : BaseIndex
-
Index to push the documents to
- $update : mixed = null
Tags
Return values
array<string|int, mixed> —Documents to be pushed
getClass()
public
getClass() : string
Return values
stringgetFieldResolver()
public
getFieldResolver() : mixed|object|Injector
Return values
mixed|object|InjectorgetItems()
public
getItems() : mixed
getLogger()
Get the logger
public
getLogger() : LoggerInterface
Tags
Return values
LoggerInterfaceisDebug()
Are we debugging?
public
isDebug() : bool
Return values
boolsetClass()
public
setClass(mixed $class) : void
Parameters
- $class : mixed
setDebug()
Set to true if debugging should be enabled
public
setDebug(bool $debug) : DocumentCoreFactory
Parameters
- $debug : bool
Return values
DocumentCoreFactorysetFieldResolver()
public
setFieldResolver(mixed|object|Injector $fieldResolver) : void
Parameters
- $fieldResolver : mixed|object|Injector
setItems()
public
setItems(mixed $items) : void
Parameters
- $items : mixed
setLogger()
Set the logger if needed
public
setLogger(LoggerInterface $logger) : void
Parameters
- $logger : LoggerInterface
addDefaultFields()
protected
abstract addDefaultFields(mixed $doc, mixed $item) : mixed
Parameters
- $doc : mixed
- $item : mixed
classEquals()
Check if a base class is an instance of the expected base group
protected
classEquals(string|DataObject $class, string $base) : bool
Parameters
- $class : string|DataObject
-
Class to compare
- $base : string
-
Base class
Return values
boolclassIs()
Determine if the given object is one of the given type
protected
classIs(string|DataObject $class, array<string|int, mixed>|string $base) : bool
Parameters
- $class : string|DataObject
-
Class to compare
- $base : array<string|int, mixed>|string
-
Class or list of base classes
Return values
boolgetShortFieldName()
protected
getShortFieldName(mixed $name) : mixed
Parameters
- $name : mixed
getValuesForField()
Use the DataResolver to find the value(s) for a field.
protected
getValuesForField(DataObject $object, array<string|int, mixed> $options) : array<string|int, mixed>
Returns an array of values, and if it's multiple, it becomes a long array
Parameters
- $object : DataObject
-
Object to resolve
- $options : array<string|int, mixed>
-
Customised options
Return values
array<string|int, mixed>indexGroupMessage()
Show the message about what is being indexed
protected
indexGroupMessage(CoreIndex $index) : void
Parameters
- $index : CoreIndex