ivanche/type-converter-bundle

0.1.0 2016-12-01 11:32 UTC

This package is not auto-updated.

Last update: 2024-09-29 02:02:11 UTC


README

#Symfony 类型转换器包

此包旨在注入一个类型转换库

#安装

使用composer安装此包

composer require ivanche/type-converter-bundle

#配置 它有一些选项。

ivanche_type_converter:
    auto_mapping: false
    strict: true

###选项: ####auto_mapping: 布尔值 (true|false)
如果转换器实现了 Ivanche\Converter\AutoMappingInterface,我们将方法调用 setAutoMapping 添加到您的转换器定义中。

如果 auto_mapping 为 true,转换器尝试将 source 的公共属性(或具有公共getter/setter的属性)设置到 target

####strict: 布尔值 (true|false)
如果转换器实现了 Ivanche\Converter\AutoMappingInterface,我们将方法调用 setStrictMode 添加到您的转换器定义中。

strict 为 true 时,如果自动映射尝试从 source 设置不存在的 target 的公共属性(或具有公共getter/setter的属性),转换器将抛出异常 Ivanche\Exception\UnsupportedSourcePropertyException