DataTransformerChain

DataTransformerChain

class DataTransformerChain implements DataTransformerInterface

Passes a value through multiple value transformers.

Methods

__construct(array $transformers)

Uses the given value transformers to transform values.

mixed transform(mixed $value)

Passes the value through the transform() method of all nested transformers.

mixed reverseTransform(mixed $value)

Passes the value through the reverseTransform() method of all nested transformers.

DataTransformerInterface[] getTransformers()

Details

__construct(array $transformers)

Uses the given value transformers to transform values.

Parameters

array $transformers

mixed transform(mixed $value)

Passes the value through the transform() method of all nested transformers.

The transformers receive the value in the same order as they were passed to the constructor. Each transformer receives the result of the previous transformer as input. The output of the last transformer is returned by this method.

Parameters

mixed $value The value in the original representation

Return Value

mixed The value in the transformed representation

Exceptions

TransformationFailedException

mixed reverseTransform(mixed $value)

Passes the value through the reverseTransform() method of all nested transformers.

The transformers receive the value in the reverse order as they were passed to the constructor. Each transformer receives the result of the previous transformer as input. The output of the last transformer is returned by this method.

Parameters

mixed $value The value in the transformed representation

Return Value

mixed The value in the original representation

Exceptions

TransformationFailedException

DataTransformerInterface[] getTransformers()

Return Value

DataTransformerInterface[]
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部