in dependencies, I add the authenticator class to the container:
$container['authenticator']=function ($c) {
return new \App\Auth\LDAPAuthenticator(...);
};
But then when I try to use it from the class App\Model\Login it searches the App\Model path. How is this possible?
constructor of App\Model\Login:
namespace App\Model;
...
$this->authenticator = $c['authenticator'];
Method in App\Model\Login:
$result = $this->authenticator($args);
Error message:
"Call to undefined method App\\Model\\Login::authenticator()
Where it should have tried to call App\Auth\LDAPAuthenticator
some clarifications, 1) this works:
$authenticator = new \App\Auth\LDAPAuthenticator(...)
2) the LDAPAuthenticator class is callable as it has an __invoke method