W3cubDocs

/Symfony 4.1

ChoicesToValuesTransformer

class ChoicesToValuesTransformer implements DataTransformerInterface

Methods

__construct(ChoiceListInterface $choiceList)
mixed transform($array)
mixed reverseTransform($array)

Details

__construct(ChoiceListInterface $choiceList)

Parameters

ChoiceListInterface $choiceList

mixed transform($array)

Parameters

$array

Return Value

mixed The value in the transformed representation

Exceptions

TransformationFailedException if the given value is not an array

mixed reverseTransform($array)

Parameters

$array

Return Value

mixed 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