Core\DataTransformer\ChoicesToBooleanArrayTransformer (Component\Form\Extension)
Symfony\Component\Form\Extension\Core\DataTransformer\ChoicesToBooleanArrayTransformer
class ChoicesToBooleanArrayTransformer implements DataTransformerInterface
Methods
__construct(ChoiceListInterface $choiceList) | ||
mixed | transform(mixed $array) Transforms an array of choices to a format appropriate for the nested checkboxes/radio buttons. | |
mixed | reverseTransform(mixed $values) Transforms a checkbox/radio button array to an array of choices. |
Details
public __construct(ChoiceListInterface $choiceList)
public mixed transform(mixed $array)
Transforms an array of choices to a format appropriate for the nested checkboxes/radio buttons.
The result is an array with the options as keys and true/false as values, depending on whether a given option is selected. If this field is rendered as select tag, the value is not modified.
public mixed reverseTransform(mixed $values)
Transforms a checkbox/radio button array to an array of choices.
The input value is an array with the choices as keys and true/false as values, depending on whether a given choice is selected. The output is an array with the selected choices.
© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToBooleanArrayTransformer.html