Then InjectExtension uses return type of RepositoryFactory::createRepository() (interface Repository) instead of type given in setType() from service definition (class ArticleRepository). So method ArticleRepository::injectService() is not found and added to generated DI container.
Expected result is that type from service definition should have priority over return type from factory.
With current state there is no way to override detected value.
Problem is related to fix of issue #218.
When nette/di 3.0.1 is used then InjectExtension behaves as expected.
Another workaround is removal of return type from RepositoryFactory::createRepository().
The text was updated successfully, but these errors were encountered: