Documentation

ChoiceLoaderInterface

Loads a choice list.

The methods and can be used to load the list only partially in cases where a fully-loaded list is not necessary.

Tags
author

Bernhard Schussek bschussek@gmail.com

Table of Contents

Methods

loadChoiceList()  : ChoiceListInterface
Loads a list of choices.
loadChoicesForValues()  : array<string|int, mixed>
Loads the choices corresponding to the given values.
loadValuesForChoices()  : array<string|int, string>
Loads the values corresponding to the given choices.

Methods

loadChoiceList()

Loads a list of choices.

public loadChoiceList([callable|null $value = null ]) : ChoiceListInterface

Optionally, a callable can be passed for generating the choice values. The callable receives the choice as only argument. Null may be passed when the choice list contains the empty value.

Parameters
$value : callable|null = null

The callable which generates the values from choices

Return values
ChoiceListInterface

loadChoicesForValues()

Loads the choices corresponding to the given values.

public loadChoicesForValues(array<string|int, string> $values[, callable|null $value = null ]) : array<string|int, mixed>

The choices are returned with the same keys and in the same order as the corresponding values in the given array.

Optionally, a callable can be passed for generating the choice values. The callable receives the choice as only argument. Null may be passed when the choice list contains the empty value.

Parameters
$values : array<string|int, string>

An array of choice values. Non-existing values in this array are ignored

$value : callable|null = null

The callable generating the choice values

Return values
array<string|int, mixed>

loadValuesForChoices()

Loads the values corresponding to the given choices.

public loadValuesForChoices(array<string|int, mixed> $choices[, callable|null $value = null ]) : array<string|int, string>

The values are returned with the same keys and in the same order as the corresponding choices in the given array.

Optionally, a callable can be passed for generating the choice values. The callable receives the choice as only argument. Null may be passed when the choice list contains the empty value.

Parameters
$choices : array<string|int, mixed>

An array of choices. Non-existing choices in this array are ignored

$value : callable|null = null

The callable generating the choice values

Return values
array<string|int, string>

        
On this page

Search results