ChoiceListInterface deprecated::getIndicesForChoices()

array getIndicesForChoices(array $choices) deprecated deprecated since version 2.4, to be removed in 3.0. Returns the indices corresponding to the given choices. The indices must be positive integers or strings accepted by {@link \Symfony\Component\Form\FormConfigBuilder::validateName()}. The index "placeholder" is internally reserved. The indices must be returned with the same keys and in the same order as the corresponding choices in the given array. Parameters array $choi

ChoiceListInterface deprecated::getChoicesForValues()

array getChoicesForValues(array $values) Returns the choices corresponding to the given values. The choices can have any data type. The choices must be returned with the same keys and in the same order as the corresponding values in the given array. Parameters array $values An array of choice values. Not existing values in this array are ignored Return Value array An array of choices with ascending, 0-based numeric keys

ChoiceListInterface deprecated::getChoices()

array getChoices() Returns the list of choices. Return Value array The choices with their indices as keys

ChoiceListInterface deprecated

interface ChoiceListInterface deprecated since version 2.7, to be removed in 3.0. Use {@link \Symfony\Component\Form\ChoiceList\ChoiceListInterface} instead. Contains choices that can be selected in a form field. Each choice has three different properties: Choice: The choice that should be returned to the application by the choice field. Can be any scalar value or an object, but no array. Label: A text representing the choice that is displayed to the user. Value: A uniquely identifying v

ChoiceListInterface

interface ChoiceListInterface A list of choices that can be selected in a choice field. A choice list assigns unique string values to each of a list of choices. These string values are displayed in the "value" attributes in HTML and submitted back to the server. The acceptable data types for the choices depend on the implementation. Values must always be strings and (within the list) free of duplicates. Methods array getChoices() Returns all selectable choices. string[] getValues()

ChoiceListFactoryInterface::createView()

ChoiceListView createView(ChoiceListInterface $list, null|array|callable $preferredChoices = null, null|callable $label = null, null|callable $index = null, null|callable $groupBy = null, null|array|callable $attr = null) Creates a view for the given choice list. Callables may be passed for all optional arguments. The callables receive the choice as first and the array key as the second argument. The callable for the label and the name should return the generated label/choice na

ChoiceListFactoryInterface::createListFromLoader()

ChoiceListInterface createListFromLoader(ChoiceLoaderInterface $loader, null|callable $value = null) Creates a choice list that is loaded with the given loader. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. Parameters ChoiceLoaderInterface $loader The choice loader null|callable $value The callable generating the choice values Return Value ChoiceListInterface The choice

ChoiceListFactoryInterface::createListFromChoices()

ChoiceListInterface createListFromChoices(array|Traversable $choices, null|callable $value = null) Creates a choice list for the given choices. The choices should be passed in the values of the choices array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. Parameters array|Traversable $choices The choices null|callable $value The callable generating the choice values Ret

ChoiceListFactoryInterface

interface ChoiceListFactoryInterface Creates {@link ChoiceListInterface} instances. Methods ChoiceListInterface createListFromChoices(array|Traversable $choices, null|callable $value = null) Creates a choice list for the given choices. ChoiceListInterface createListFromLoader(ChoiceLoaderInterface $loader, null|callable $value = null) Creates a choice list that is loaded with the given loader. ChoiceListView createView(ChoiceListInterface $list, null|array|callable $preferredCh

ChoiceList deprecated::getValuesForChoices()

array getValuesForChoices(array $choices) Returns the values corresponding to the given choices. The values must be strings. The values must be returned with the same keys and in the same order as the corresponding choices in the given array. Parameters array $choices An array of choices. Not existing choices in this array are ignored Return Value array An array of choice values with ascending, 0-based numeric keys