reliv/zf-input-filter-service

使用ZendFrameworks InputFilter配置,从通用服务容器中的服务构建过滤器验证器

0.1.1 2017-06-29 19:14 UTC

This package is auto-updated.

Last update: 2024-09-11 14:21:17 UTC


README

允许服务作为输入过滤器

  • 使用ZendFrameworks InputFilter配置,从通用服务容器中的服务构建过滤器验证器。

  • 需要添加特殊配置值到ZFs标准配置格式

  • 回退到ZFs标准输入过滤器工厂

  • 使用配置作为

    [
        'test1' => [
            'name' => 'test1',
            'required' => true,
            'filters' => [
                [
                    // Invoked
                    'name' => 'ZfInputFilterService\Filter\Test',
                    'options' => [
                        'test' => 'filterOptionInvoked'
                    ],
                ],
                [
                    // Service
                    'name' => 'ZfInputFilterService\Filter\TestService',
                    'service' => true,
                    'options' => [
                        'test' => 'filterOptionService'
                    ]
                ]
            ],
            'validators' => [
                [
                    // Invoked
                    'name' => 'ZfInputFilterService\Validator\Test',
                    'options' => [
                        'test' => 'validatorOptionInvoked',
                        'messages' => [
                            'TEST' => 'validatorMessageTemplateInvoked',
                        ],
                    ],
                ],
                [
                    // Service
                    'name' => 'ZfInputFilterService\Validator\TestService',
                    'service' => true,
                    'options' => [
                        'test' => 'validatorOptionService',
                        'messages' => [
                            'TEST' => 'validatorMessageTemplateService',
                        ],
                    ],
                ],
            ],
        ],
        // InputFilter Config Sevice
        'subtest1' => [
            // Service
            'name' => 'subtest1',
            'service' => true,
            'type' => 'ZfInputFilterService\InputFilter\TestInputFilter',
            'options' => [
                'test' => 'My test properties'
            ]
        ],
    ],
    
  • 注意:这是一个基本的修改,以解决ZF输入过滤器和工厂编写方式愚蠢的问题