Input filters and validations are often used together in save operations. For an input filter to work, it must first be defined in the App/ConfigProvider.php file, as in the following example.
declare(strict_types=1);
use Laminas\ServiceManager\AbstractFactory\ReflectionBasedAbstractFactory;
namespace App;
class ConfigProvider
{
public function __invoke() : array
{
return [
'dependencies' => $this->getDependencies(),
'input_filters' => [
'factories' => [
Filter\Companies\SaveFilter::class => Filter\Companies\SaveFilterFactory::class,
Filter\CollectionInputFilter::class => Container\CollectionInputFilterFactory::class,
Filter\ObjectInputFilter::class => Container\ObjectInputFilterFactory::class,
],
]
];
}
public function getDependencies() : array
{
return [
'factories' => [
]
];
}
}