Symfony2 API
Class

Symfony\Component\Form\Extension\Core\DataTransformer\BooleanToStringTransformer

class BooleanToStringTransformer implements DataTransformerInterface

Transforms between a Boolean and a string.

Methods

__construct(string $trueValue)

Sets the value emitted upon transform if the input is true.

string transform(Boolean $value)

Transforms a Boolean into a string.

Boolean reverseTransform(string $value)

Transforms a string into a Boolean.

Details

at line 36
public __construct(string $trueValue)

Sets the value emitted upon transform if the input is true.

Parameters

string $trueValue

at line 50
public string transform(Boolean $value)

Transforms a Boolean into a string.

Parameters

Boolean $value Boolean value.

Return Value

string String value.

Exceptions

TransformationFailedException If the given value is not a Boolean.

at line 72
public Boolean reverseTransform(string $value)

Transforms a string into a Boolean.

Parameters

string $value String value.

Return Value

Boolean Boolean value.

Exceptions

TransformationFailedException If the given value is not a string.