PropertyAccessDecorator
in package
implements
ChoiceListFactoryInterface
Adds property path support to a choice list factory.
Pass the decorated factory to the constructor:
$decorator = new PropertyAccessDecorator($factory);
You can now pass property paths for generating choice values, labels, view indices, HTML attributes and for determining the preferred choices and the choice groups:
// extract values from the $value property
$list = $createListFromChoices($objects, 'value');
Tags
Interfaces, Classes, Traits and Enums
- ChoiceListFactoryInterface
- Creates {@link ChoiceListInterface} instances.
Table of Contents
- $decoratedFactory : mixed
- $propertyAccessor : mixed
- __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.
Properties
$decoratedFactory
private
mixed
$decoratedFactory
$propertyAccessor
private
mixed
$propertyAccessor
Methods
__construct()
public
__construct(ChoiceListFactoryInterface $decoratedFactory[, PropertyAccessorInterface $propertyAccessor = null ]) : mixed
Parameters
- $decoratedFactory : ChoiceListFactoryInterface
- $propertyAccessor : PropertyAccessorInterface = null
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
Return values
ChoiceListInterface —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
Return values
ChoiceListInterface —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
- $label : mixed = null
- $index : mixed = null
- $groupBy : mixed = null
- $attr : mixed = null
Return values
ChoiceListView —getDecoratedFactory()
Returns the decorated factory.
public
getDecoratedFactory() : ChoiceListFactoryInterface
Return values
ChoiceListFactoryInterface —The decorated factory