-
Notifications
You must be signed in to change notification settings - Fork 50
Input with filter inside construct #8
Comments
Nothing should overwrite if you do If however you use the PluginManager to get your Filter, then you should be overwriting the |
in my login input filter i do this:
and Login not call init method of senha filter |
Still too early in the morning. Could you try adding the Fabio Ginzel [email protected] schrieb am Mi., 29. Juli 2015 um
|
With InitializableInterface it calls init, but in the line 202 of Zend\InputFilter\Factory it overwrites filterchain:
|
@fabioginzel You have two choices:
You have to choose which approach you want. We cannot support both simultaneously. Since you seem concerned with being able to attach custom filters, you have two possible approaches. First, make sure they're registered in the filter plugin factory. If they are, then you can attach them during Alternately, override public function setFilterChain(FilterChain $chain)
{
$chain->attachByName('StringTrim'); // etc.
return parent::setFilterChain($chain);
} Each of the approaches listed above are viable with the current code base. |
BTW, I'm totally not seeing how you came to this conclusion. That patch does not touch any code that would inject the filter chain or validator chain in the least; all it does is allow you to specify the class to use when instantiating an input. |
In my tests Init() is called before factory inject filter chain, overwriting my filters Before patch its return input and not inject default filter chain |
@weierophinney, I can confirm, what @fabioginzel wrote: The InputFilterChain will then be overwritten some lines below: The only work around I see is, to prevent setting a filter chain via the setter: public function __construct($name = null)
{
parent::__construct($name);
$this->filterChain = new FilterChain();
}
public function setFilterChain(FilterChain $filterChain)
{
} ... kind of ugly. |
… manager As reported in zendframework#8, a change in zendframework#2 now causes inputs pulled from the plugin manager within `Factory::createInput()` to be injected with the default filter and validator chains composed in the `Factory`. This can cause filter and validator chains created during construction or within the input's factory to be overwritten entirely. This patch adds conditions to skip injection of the default filter and validator chains on inputs pulled from the input filter manager, while retaining the logic introduced in zendframework#2 to allow values in the `$inputSpecification` to further configure the instance.
In my code i have input construct code:
use Zend\InputFilter\Input;
class Senha extends Input
{
}
in pull:
#2
this break, because factory overwrite filters
The text was updated successfully, but these errors were encountered: