Phalcon 4.0 Phalcon\Filter\FilterLocatorFactory();

Recently installed Phalcon 4.0 on a new server and I am refactoring the code to take account of the new changes.

I cannot access the class FilterLocatorFactory(); for some reason.

In the app I have tried use Phalcon\Di; use Phalcon\Filter\FilterLocatorFactory;

$container = new Di();

$container->set(
'filter',
function () {
    $someFilter = new FilterLocatorFactory();
    return $factory->newInstance();
}
);

But this come back with the error:

PHP Fatal error:  Uncaught Error: Class 'Phalcon\\Filter\\FilterLocatorFactory' not found in /var/foo/bar

For maintainability I want to instantiate the filter in the $di then just call it from anywhere using:

$this->filter("mynaastystring","string");

Any advice would be much appreciated. Cannot seem to acces it in on-construct() or inisitalize() either.

Thanks

Phalcon 4 is still in beta stage ( https://github.com/phalcon/cphalcon/releases ), I'd advise using it in a production environment.

Also, if you check the publish logs, they have renamed a lot of stuff:

Renamed Phalcon\Filter\FilterLocatorFactory to Phalcon\Filter\FilterFactory

Hi;

this worked like a treat. I managed to get it in and working.

Defined it in the$di and then was able to access it throughout the application

4.0 seems to have a lot of very good improvements but I would advise checking compatibility now because it breaks quite a few things from the older versions.

THanks for the the assist @Lajos Bencz!