AbstractJsonRecordCollectionFactory
in package
implements
RecordCollectionFactoryInterface
Simple factory for record collection.
Tags
Interfaces, Classes, Traits and Enums
- RecordCollectionFactoryInterface
- Search backend record collection factory interface.
Table of Contents
- $collectionClass : string
- Class of collection.
- $recordFactory : callable
- Factory to turn data into a record object.
- __construct() : void
- Constructor.
- factory() : RecordCollection
- Return record collection.
- getDefaultRecordCollectionClass() : string
- Get the class name of the record collection to use by default.
- getDocumentListFromResponse() : array<string|int, mixed>
- Given a backend response, return an array of documents.
Properties
$collectionClass
Class of collection.
protected
string
$collectionClass
$recordFactory
Factory to turn data into a record object.
protected
callable
$recordFactory
Methods
__construct()
Constructor.
public
__construct([callable $recordFactory = null ][, string $collectionClass = null ]) : void
Parameters
- $recordFactory : callable = null
-
Record factory callback (null for default)
- $collectionClass : string = null
-
Class of collection
Return values
void —factory()
Return record collection.
public
factory(array<string|int, mixed> $response) : RecordCollection
Parameters
- $response : array<string|int, mixed>
-
Backend response
Return values
RecordCollection —getDefaultRecordCollectionClass()
Get the class name of the record collection to use by default.
protected
abstract getDefaultRecordCollectionClass() : string
Return values
string —getDocumentListFromResponse()
Given a backend response, return an array of documents.
protected
abstract getDocumentListFromResponse(array<string|int, mixed> $response) : array<string|int, mixed>
Parameters
- $response : array<string|int, mixed>
-
Backend response