When I use InputFilter required is not considered in int filters
$inputFilter->add($factory->createInput(array(
'name' => 'id',
'required' => true,
'filters' => array(
array('name' => 'Int'),
),
)));
Are you sure you want to use the Int InputFilter? Its function is to convert a scalar value to an Integer. Its code is just:
public function filter($value)
{
return (int) ((string) $value);
}
Which transforms the value to a string. If your value is an empty string, it'll convert it to 0, the reason why afterwards, in the validator's execution process, the required is not working (it checks a 0).
It seems to me, because of the name id of your input, that you just want to force users to enter something that must be a numeric. You can do it this way:
$inputFilter->add( $factory->createInput( array(
'name' => 'id',
'required' => true,
'validators' => array(
array( 'name' => 'Digits' ),
)
) );