Oihana PHP

PrepareIDs

Prepares the identifier list of a controller request.

This trait normalizes a list of identifiers into a comma-separated string. The value resolves from the route arguments or the matching controller property (arrays are imploded with Char::COMMA); a string query parameter overrides it and, when present, the value is recorded in the parameter bag. The parameter name defaults to ControllerParam::IDS but can be customized.

Tags
author

Marc Alcaraz (ekameleon)

since
1.0.0

Table of Contents

Properties

$ids  : null|string|array<string|int, mixed>
The default ids representation, a string list with comma separator or an array.

Methods

initializeIDs()  : void
Initialize all skins properties with an associative array definition.
preparedIDs()  : string|null
Prepares the identifier list representation (by default ids).

Properties

$ids

The default ids representation, a string list with comma separator or an array.

public null|string|array<string|int, mixed> $ids = null

Methods

initializeIDs()

Initialize all skins properties with an associative array definition.

protected initializeIDs([array<string|int, mixed> $init = [] ]) : void
Parameters
$init : array<string|int, mixed> = []

The configuration array, optionally carrying a ControllerParam::IDS entry.

preparedIDs()

Prepares the identifier list representation (by default ids).

protected preparedIDs(ServerRequestInterface|null $request[, array<string|int, mixed> $args = [] ][, array<string|int, mixed>|null &$params = [] ][, string|null $name = ControllerParam::IDS ]) : string|null
Parameters
$request : ServerRequestInterface|null

The incoming PSR-7 server request, or null when no request context is available.

$args : array<string|int, mixed> = []

The route/controller arguments that may carry an initial identifier list.

$params : array<string|int, mixed>|null = []

A reference to the parameter bag updated in place with the comma-separated identifiers.

$name : string|null = ControllerParam::IDS

The name of the identifier parameter to read and store (defaults to ControllerParam::IDS).

Return values
string|null

The resolved comma-separated identifier list, or null when none is provided.

On this page

Search results