#
LazyChoiceList
^{deprecated}

abstract class
**LazyChoiceList** implements
ChoiceListInterface

^{deprecated}
since
version 2.7, to be removed in 3.0.
Use {@link \Symfony\Component\Form\ChoiceList\LazyChoiceList} instead.

A choice list that is loaded lazily.

This list loads itself as soon as any of the getters is accessed for the first time. You should implement loadChoiceList() in your child classes, which should return a ChoiceListInterface instance.

## Methods

Returns the list of choices.

Returns the values for the choices.

Returns the choice views of the preferred choices as nested array with the choice groups as top-level keys.

Returns the choice views of the choices that are not preferred as nested array with the choice groups as top-level keys.

Returns the choices corresponding to the given values.

Returns the values corresponding to the given choices.

^{deprecated}

Returns the indices corresponding to the given choices.

^{deprecated}

Returns the indices corresponding to the given values.

Loads the choice list.

## Details

###
at line 42
```
array
```**getChoices**()

**getChoices**()

Returns the list of choices.

###
at line 54
```
array
```**getValues**()

**getValues**()

Returns the values for the choices.

###
at line 66
```
array
```**getPreferredViews**()

**getPreferredViews**()

Returns the choice views of the preferred choices as nested array with the choice groups as top-level keys.

Example:

###
at line 78
```
array
```**getRemainingViews**()

**getRemainingViews**()

Returns the choice views of the choices that are not preferred as nested array with the choice groups as top-level keys.

Example:

###
at line 90
```
array
```**getChoicesForValues**(array $values)

**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.

###
at line 102
```
array
```**getValuesForChoices**(array $choices)

**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.

###
at line 116
```
array
```**getIndicesForChoices**(array $choices)
^{deprecated}

**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.

###
at line 132
```
array
```**getIndicesForValues**(array $values)
^{deprecated}

**getIndicesForValues**(array $values)

^{deprecated}

^{deprecated}
since
version 2.4, to be removed in 3.0.

Returns the indices corresponding to the given values.

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 values in the given array.

###
at line 150
```
abstract protected ChoiceListInterface
```**loadChoiceList**()

**loadChoiceList**()

Loads the choice list.

Should be implemented by child classes.