CallbackTransformer

CallbackTransformer

class CallbackTransformer implements DataTransformerInterface

Methods

__construct(callable $transform, callable $reverseTransform)

Constructor.

mixed transform(mixed $data)

Transforms a value from the original representation to a transformed representation.

mixed reverseTransform(mixed $data)

Transforms a value from the transformed representation to its original representation.

Details

__construct(callable $transform, callable $reverseTransform)

Constructor.

Parameters

callable $transform The forward transform callback
callable $reverseTransform The reverse transform callback

mixed transform(mixed $data)

Transforms a value from the original representation to a transformed representation.

Parameters

mixed $data The value in the original representation

Return Value

mixed The value in the transformed representation

Exceptions

UnexpectedTypeException when the argument is not of the expected type
TransformationFailedException when the transformation fails

mixed reverseTransform(mixed $data)

Transforms a value from the transformed representation to its original representation.

Parameters

mixed $data The value in the transformed representation

Return Value

mixed The value in the original representation

Exceptions

UnexpectedTypeException when the argument is not of the expected type
TransformationFailedException when the transformation fails

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.3/Symfony/Component/Form/CallbackTransformer.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部