abstract class AbstractListController extends AbstractSerializeController

Properties

string $serializer <p>The name of the serializer class to output results with.</p> from AbstractSerializeController
array $include <p>The relationships that are included by default.</p> from AbstractSerializeController
array $optionalInclude <p>The relationships that are available to be included.</p> from AbstractSerializeController
int $maxLimit <p>The maximum number of records that can be requested.</p> from AbstractSerializeController
int $limit <p>The number of records included by default.</p> from AbstractSerializeController
array $sortFields <p>The fields that are available to be sorted by.</p> from AbstractSerializeController
array|null $sort <p>The default sort field and order to user.</p> from AbstractSerializeController
static protected Container $container from AbstractSerializeController
static protected array $beforeDataCallbacks from AbstractSerializeController
static protected array $beforeSerializationCallbacks from AbstractSerializeController
static protected string[] $loadRelations from AbstractSerializeController
static protected array<string,callable> $loadRelationCallables from AbstractSerializeController

Methods

ResponseInterface
handle(ServerRequestInterface $request)

<p>{@inheritdoc}</p>

mixed
data(ServerRequestInterface $request, Document $document)

<p>Get the data to be serialized and assigned to the response document.</p>

ElementInterface
createElement(mixed $data, SerializerInterface $serializer)

<p>Create a PHP JSON-API Element for output in the document.</p>

array
getRelationsToLoad(Collection $models)

<p>Returns the relations to load added by extenders.</p>

array
getRelationCallablesToLoad(Collection $models)

<p>Returns the relation callables to load added by extenders.</p>

void
loadRelations(Collection $models, array $relations, ServerRequestInterface $request = null)

<p>Eager loads the required relationships.</p>

array
extractInclude(ServerRequestInterface $request)

No description

array
extractFields(ServerRequestInterface $request)

No description

array|null
extractSort(ServerRequestInterface $request)

No description

int
extractOffset(ServerRequestInterface $request)

No description

int
extractLimit(ServerRequestInterface $request)

No description

array
extractFilter(ServerRequestInterface $request)

No description

Parameters
buildParameters(ServerRequestInterface $request)

No description

bool
sortIsDefault(ServerRequestInterface $request)

No description

setSerializer(string $serializer)

<p>Set the serializer that will serialize data for the endpoint.</p>

addInclude(string|array $name)

<p>Include the given relationship by default.</p>

removeInclude(string|array $name)

<p>Don't include the given relationship by default.</p>

addOptionalInclude(string|array $name)

<p>Make the given relationship available for inclusion.</p>

removeOptionalInclude(string|array $name)

<p>Don't allow the given relationship to be included.</p>

setLimit(int $limit)

<p>Set the default number of results.</p>

setMaxLimit(int $max)

<p>Set the maximum number of results.</p>

addSortField(string|array $field)

<p>Allow sorting results by the given field.</p>

removeSortField(string|array $field)

<p>Disallow sorting results by the given field.</p>

setSort(array $sort)

<p>Set the default sort order for the results.</p>

static Container
getContainer()

No description

static 
setContainer(Container $container)

No description

static 
addDataPreparationCallback(string $controllerClass, callable $callback)

No description

static 
addSerializationPreparationCallback(string $controllerClass, callable $callback)

No description

static 
setLoadRelations(string $controllerClass, array $relations)

No description

static 
setLoadRelationCallables(string $controllerClass, array $relations)

No description

Details

ResponseInterface handle(ServerRequestInterface $request)

<p>{@inheritdoc}</p>

Parameters

ServerRequestInterface $request

Return Value

ResponseInterface

abstract protected mixed data(ServerRequestInterface $request, Document $document)

<p>Get the data to be serialized and assigned to the response document.</p>

Parameters

ServerRequestInterface $request
Document $document

Return Value

mixed

protected ElementInterface createElement(mixed $data, SerializerInterface $serializer)

<p>Create a PHP JSON-API Element for output in the document.</p>

Parameters

mixed $data
SerializerInterface $serializer

Return Value

ElementInterface

protected array getRelationsToLoad(Collection $models)

<p>Returns the relations to load added by extenders.</p>

Parameters

Collection $models

Return Value

array

protected array getRelationCallablesToLoad(Collection $models)

<p>Returns the relation callables to load added by extenders.</p>

Parameters

Collection $models

Return Value

array

protected void loadRelations(Collection $models, array $relations, ServerRequestInterface $request = null)

<p>Eager loads the required relationships.</p>

Parameters

Collection $models
array $relations
ServerRequestInterface $request

Return Value

void

protected array extractInclude(ServerRequestInterface $request)

Parameters

ServerRequestInterface $request

Return Value

array

Exceptions

InvalidParameterException

protected array extractFields(ServerRequestInterface $request)

Parameters

ServerRequestInterface $request

Return Value

array

protected array|null extractSort(ServerRequestInterface $request)

Parameters

ServerRequestInterface $request

Return Value

array|null

Exceptions

InvalidParameterException

protected int extractOffset(ServerRequestInterface $request)

Parameters

ServerRequestInterface $request

Return Value

int

Exceptions

InvalidParameterException

protected int extractLimit(ServerRequestInterface $request)

Parameters

ServerRequestInterface $request

Return Value

int

protected array extractFilter(ServerRequestInterface $request)

Parameters

ServerRequestInterface $request

Return Value

array

protected Parameters buildParameters(ServerRequestInterface $request)

Parameters

ServerRequestInterface $request

Return Value

Parameters

protected bool sortIsDefault(ServerRequestInterface $request)

Parameters

ServerRequestInterface $request

Return Value

bool

setSerializer(string $serializer)

<p>Set the serializer that will serialize data for the endpoint.</p>

Parameters

string $serializer

addInclude(string|array $name)

<p>Include the given relationship by default.</p>

Parameters

string|array $name

removeInclude(string|array $name)

<p>Don't include the given relationship by default.</p>

Parameters

string|array $name

addOptionalInclude(string|array $name)

<p>Make the given relationship available for inclusion.</p>

Parameters

string|array $name

removeOptionalInclude(string|array $name)

<p>Don't allow the given relationship to be included.</p>

Parameters

string|array $name

setLimit(int $limit)

<p>Set the default number of results.</p>

Parameters

int $limit

setMaxLimit(int $max)

<p>Set the maximum number of results.</p>

Parameters

int $max

addSortField(string|array $field)

<p>Allow sorting results by the given field.</p>

Parameters

string|array $field

removeSortField(string|array $field)

<p>Disallow sorting results by the given field.</p>

Parameters

string|array $field

setSort(array $sort)

<p>Set the default sort order for the results.</p>

Parameters

array $sort

static Container getContainer()

Return Value

Container

static setContainer(Container $container)

Parameters

Container $container

static addDataPreparationCallback(string $controllerClass, callable $callback)

Parameters

string $controllerClass
callable $callback

static addSerializationPreparationCallback(string $controllerClass, callable $callback)

Parameters

string $controllerClass
callable $callback

static setLoadRelations(string $controllerClass, array $relations)

Parameters

string $controllerClass
array $relations

static setLoadRelationCallables(string $controllerClass, array $relations)

Parameters

string $controllerClass
array $relations