2 years ago
#7689

mademyday
Slim 4 php-di Factory function not running as expected / not "fully" called
i'm having problems registering a factory causing a strange behaviour.
When my dependency is resolved by the factory function i can see (by testing..), that actually only the constructor is called, nothing more.
Here's the factory function + DI definition:
AuthStrategySelectorInterface::class => function (ContainerInterface $container): AuthStrategySelector {
$authStrategySelector = new AuthStrategySelector();
$authStrategySelector
->register($container->get(JwtAuthStrategy::class));
return $authStrategySelector;
}
And heres the behaviour i can see, but i don't understand:
It seems like the register
-function never gets called.. I also confirmed that by just writing something like die('test');
behind the instantiation of $authStrategySelector
.
I can't see any error inside the logs, etc. and i wrapped my head around that problem since like 2 hours..
And i tested every other involved component like the AuthStrategy, which is even empty for testing..
php
dependency-injection
slim
php-di
slim-4
0 Answers
Your Answer