W3cubDocs

/Symfony 2.7

Symfony\Component\Form\Extension\Core\DataTransformer\ChoicesToValuesTransformer

class ChoicesToValuesTransformer implements DataTransformerInterface

Methods

__construct(ChoiceListInterface $choiceList)

Constructor.

array transform(array $array)
array reverseTransform(array $array)

Details

public __construct(ChoiceListInterface $choiceList)

Constructor.

Parameters

ChoiceListInterface $choiceList

public array transform(array $array)

Parameters

array $array

Return Value

array The value in the transformed representation

Exceptions

TransformationFailedException If the given value is not an array.

public array reverseTransform(array $array)

Parameters

array $array

Return Value

array The value in the original representation

Exceptions

TransformationFailedException If the given value is not an array or if no matching choice could be found for some given value.