Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList
A choice list for choices of type string or integer.
Choices and their associated labels can be passed in a single array. Since
choices are passed as array keys, only strings or integer choices are
allowed. Choices may also be given as hierarchy of unlimited depth by
creating nested arrays. The title of the sub-hierarchy can be stored in the
array key pointing to the nested array.
<code>
$choiceList = new SimpleChoiceList(array(
'creditcard' => 'Credit card payment',
'cash' => 'Cash payment',
));
</code>
- Author: Bernhard Schussek <bschussek@gmail.com>
Synopsis
class SimpleChoiceList
extends ChoiceList
{
- // methods
- public void __construct()
- public void getChoicesForValues()
- public void getValuesForChoices()
- protected void addChoices()
- protected Boolean isPreferred()
- protected string|integer fixChoice()
- protected void fixChoices()
- protected void createValue()
- // Inherited methods from ChoiceList
- public void __construct()
- protected void initialize()
- public void getChoices()
- public void getValues()
- public void getPreferredViews()
- public void getRemainingViews()
- public void getChoicesForValues()
- public void getValuesForChoices()
- public void getIndicesForChoices()
- public void getIndicesForValues()
- protected void addChoices()
- protected void addChoiceGroup()
- protected void addChoice()
- protected Boolean isPreferred()
- protected integer|string createIndex()
- protected string createValue()
- protected string fixValue()
- protected array fixValues()
- protected integer|string fixIndex()
- protected array fixIndices()
- protected mixed fixChoice()
- protected array fixChoices()
Hierarchy
Methods
protected
- addChoices() — Recursively adds the given choices to the list.
- createValue() — {@inheritdoc}
- fixChoice() — Converts the choice to a valid PHP array key.
- fixChoices() — {@inheritdoc}
- isPreferred() — Returns whether the given choice should be preferred judging by the given array of preferred choices.
public
- __construct() — Creates a new simple choice list.
- getChoicesForValues() — {@inheritdoc}
- getValuesForChoices() — {@inheritdoc}
Inherited from Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList
protected
- addChoice() — Adds a new choice.
- addChoiceGroup() — Recursively adds a choice group.
- addChoices() — Recursively adds the given choices to the list.
- createIndex() — Creates a new unique index for this choice.
- createValue() — Creates a new unique value for this choice.
- fixChoice() — Fixes the data type of the given choice to avoid comparison problems.
- fixChoices() — Fixes the data type of the given choices to avoid comparison problems.
- fixIndex() — Fixes the data type of the given choice index to avoid comparison problems.
- fixIndices() — Fixes the data types of the given choice indices to avoid comparison problems.
- fixValue() — Fixes the data type of the given choice value to avoid comparison problems.
- fixValues() — Fixes the data types of the given choice values to avoid comparison problems.
- initialize() — Initializes the list with choices.
- isPreferred() — Returns whether the given choice should be preferred judging by the given array of preferred choices.
public
- getChoices() — {@inheritdoc}
- getChoicesForValues() — {@inheritdoc}
- getIndicesForChoices() — {@inheritdoc}
- getIndicesForValues() — {@inheritdoc}
- getPreferredViews() — {@inheritdoc}
- getRemainingViews() — {@inheritdoc}
- getValues() — {@inheritdoc}
- getValuesForChoices() — {@inheritdoc}