Hi I'm using Phalcon 3.4. I created a custom filter class and added it in the bootstrap.
use Phalcon\Filter;
$di->setShared('filter', function() {
$filter = new Filter();
$filter->add('nullFilter', new NullFilter());
return $filter;
});
i want to use my filter in requests added as a default, overriding Phalcon\HttpRequest::getPost and similar functions.
public function getPost($name = null, $filters = null, $defaultValue = null, $notAllowEmpty = false, $noRecursive = false)
{
if ($filters === null)
$filters = [];
elseif (!is_array($filters))
$filters = [$filters];
$filters[] = 'nullFilter';
return parent::getPost($name, $filters, $defaultValue, $notAllowEmpty, $noRecursive);
}
But it doesn't work, I don't know how to add custom filter to be usable in request. Any advice?