CachingFactoryDecorator
in package
implements
ChoiceListFactoryInterface, ResetInterface
Caches the choice lists created by the decorated factory.
Tags
Interfaces, Classes, Traits and Enums
- ChoiceListFactoryInterface
- Creates {@link ChoiceListInterface} instances.
- ResetInterface
- Provides a way to reset an object to its initial state.
Table of Contents
- $decoratedFactory : mixed
- $lists : array<string|int, ChoiceListInterface>
- $views : array<string|int, ChoiceListView>
- __construct() : mixed
- createListFromChoices() : ChoiceListInterface
- Creates a choice list for the given choices.
- createListFromLoader() : ChoiceListInterface
- Creates a choice list that is loaded with the given loader.
- createView() : ChoiceListView
- Creates a view for the given choice list.
- getDecoratedFactory() : ChoiceListFactoryInterface
- Returns the decorated factory.
- reset() : mixed
Properties
$decoratedFactory
private
mixed
$decoratedFactory
$lists
private
array<string|int, ChoiceListInterface>
$lists
= []
$views
private
array<string|int, ChoiceListView>
$views
= []
Methods
__construct()
public
__construct(ChoiceListFactoryInterface $decoratedFactory) : mixed
Parameters
- $decoratedFactory : ChoiceListFactoryInterface
Return values
mixed —createListFromChoices()
Creates a choice list for the given choices.
public
createListFromChoices(mixed $choices[, mixed $value = null ]) : ChoiceListInterface
Parameters
- $choices : mixed
-
The choices
- $value : mixed = null
-
The callable generating the choice values
Return values
ChoiceListInterface —The choice list
createListFromLoader()
Creates a choice list that is loaded with the given loader.
public
createListFromLoader(ChoiceLoaderInterface $loader[, mixed $value = null ]) : ChoiceListInterface
Parameters
- $loader : ChoiceLoaderInterface
- $value : mixed = null
-
The callable generating the choice values
Return values
ChoiceListInterface —The choice list
createView()
Creates a view for the given choice list.
public
createView(ChoiceListInterface $list[, mixed $preferredChoices = null ][, mixed $label = null ][, mixed $index = null ][, mixed $groupBy = null ][, mixed $attr = null ]) : ChoiceListView
Parameters
- $list : ChoiceListInterface
- $preferredChoices : mixed = null
-
The preferred choices
- $label : mixed = null
-
The callable generating the choice labels; pass false to discard the label
- $index : mixed = null
-
The callable generating the view indices
- $groupBy : mixed = null
-
The callable generating the group names
- $attr : mixed = null
-
The callable generating the HTML attributes
Return values
ChoiceListView —The choice list view
getDecoratedFactory()
Returns the decorated factory.
public
getDecoratedFactory() : ChoiceListFactoryInterface
Return values
ChoiceListFactoryInterface —The decorated factory
reset()
public
reset() : mixed