Cast the input value to another PHP type using settype().
- Service:
CleverAge\ProcessBundle\Transformer\CastTransformer - Transformer code:
cast
any
any: the input value converted to the configured type.
| Code | Type | Required | Default | Description |
|---|---|---|---|---|
type |
string |
X | Target type, any value accepted by settype() (bool, boolean, int, integer, float, double, string, array, object, null) |
- Cast a string to an integer
# Transformer options level
cast:
type: int- Convert a
stdClass(e.g. a SOAP response item) to an array
# Transformer options level
cast:
type: arrayThe type value is not validated at configuration time: an invalid type throws a ValueError on transformation. See
TypeSetterTransformer for a variant validating the type upfront.