Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList
A choice list for object choices.
Supports generation of choice labels, choice groups and choice values
by calling getters of the object (or associated objects).
<code>
$choices = array($user1, $user2);
// call getName() to determine the choice labels
$choiceList = new ObjectChoiceList($choices, 'name');
</code>
- Author: Bernhard Schussek <bschussek@gmail.com>
Synopsis
class ObjectChoiceList
extends ChoiceList
{
- // members
- private PropertyAccessorInterface $propertyAccessor;
- private PropertyPath $labelPath;
- private PropertyPath $groupPath;
- private PropertyPath $valuePath;
- // methods
- public void __construct()
- protected void initialize()
- protected integer|string createValue()
- private void extractLabels()
- // 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
Extends
Extended by
Members
private
- $groupPath
—
Symfony\Component\PropertyAccess\PropertyPath
The property path used for object grouping. - $labelPath
—
Symfony\Component\PropertyAccess\PropertyPath
The property path used to obtain the choice label. - $propertyAccessor — Symfony\Component\PropertyAccess\PropertyAccessorInterface
- $valuePath
—
Symfony\Component\PropertyAccess\PropertyPath
The property path used to obtain the choice value.
Methods
private
protected
- createValue() — Creates a new unique value for this choice.
- initialize() — Initializes the list with choices.
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}