On 14 June 2014 17:28, Oliver Koenig [via Zend Framework Community] <
[email protected]> wrote:

> Hi,
>
> I was trying to override a default validator and stumbled upon sometzhing
> I found weird.
> Each instance of Zend\InputFilter\Input instantiates its own instance of
> Zend\Validator\ValidatorChain.
> Each instance of Zend\Validator\ValidatorChain instantiates its own
> instance of Zend\Validator\ValidatorPluginManager.
>

That should only be the case if the input filter was not built through the
InputFilterPluginManager. Can you verify that?


> So that means in effect, every input field with a validator instantiates a
> new ValidatorPluginManager.
>

Also here, only if the form didn't spawn from the FormElementManager


> Is this behaviour supposed to be desirable?
>

No, but the alternate solution is having a static reference to a plugin
manager, which is much worse.


>
> The reason why I was in need to override the behaviour of a default
> validator: I use FilePRG and get the ATTACK error message from the
> validator, because the file is not in the HTTP POST after FilePRG.
> I use factory backed form creation, it's not an option to switch to code
> based form creation.
>

I'd check if you can use the FormElementManager coming from the main
ServiceManager instance to build your forms (or a form factory).

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/instantiation-of-validator-plugin-manager-tp4662142p4662145.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to