-
Notifications
You must be signed in to change notification settings - Fork 42
Autowiring for Flagception\Manager\FeatureManagerInterface does not work as stated in the docs #75
Comments
This should work normally. The we have defined an alias for the FeatureManagerInterface here: https://github.com/bestit/flagception-bundle/blob/3.x/src/Resources/config/services.yml#L9 Do you have activate autowire in your project (https://symfony.com/doc/current/service_container/autowiring.html)?
|
Yes: services:
_defaults:
autowire: true
autoconfigure: true
bind:
$projectDir: '%kernel.project_dir%' The same thing happens if I type-hint the Maybe it is because
|
If i inject the FeatureManager manually, it works too. App\Foo\Bar:
arguments: ['@flagception.manager.feature_manager'] |
Yes, the
No, thats irrelevant. I will try to reproduce it in the next days. You can set it manually until it is solved (like you already do). |
Which version do you have installed? |
Thank you for your help. |
I created an example repository which reproduces this issue: In addition I have the following comments:
I hope that helps! |
OK, sorry for the comment spam, but i found the issue. I installed your bundle with This is wrong, as this states that the v3.0.0 is requested (instead of 3.5.1). The 3.0.0 version from your bundle is missing the Interface-alias line in the services.yaml. So the solution is too simple: I changed the line in the composer.json to The only question that remains: Why does composer write the explicit reference to version 3.0.0 ("3") in the composer.json? |
I created #76 to avoid misunderstandings (so, and now I'm no longer annoying) ;-) |
Thanks for your work. ;-) I think we can close this issue. |
This bundle is used in an PHP 7.3 / Symfony 4.4 application. There is a service which expects an Flagception\Manager\FeatureManagerInterface instance in the constructor:
Symfony throws a RuntimeException now:
The documentation does not mention that I have to add the following entry in the services.yaml:
As soon as this addition has been added, the autowiring works as expected. Was it forgotten in the documentation or did I do something wrong?
The text was updated successfully, but these errors were encountered: