Comments (10)
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)?
# config/services.yaml
services:
_defaults:
autowire: true
from flagception-bundle.
Yes:
services:
_defaults:
autowire: true
autoconfigure: true
bind:
$projectDir: '%kernel.project_dir%'
The same thing happens if I type-hint the FeatureManager
instead of the FeatureManagerInterface
.
Maybe it is because flagception.manager.feature_manager
is not autowired / autoconfigured?
λ php bin/console debug:container Flagception
Select one of the following services to display its information:
[0 ] flagception.configurator.array_configurator
[1 ] flagception.configurator.constraint_configurator
[2 ] flagception.configurator.environment_configurator
[3 ] flagception.configurator.contentful_configurator
[4 ] flagception.configurator.cookie_configurator
[5 ] flagception.manager.feature_manager
[6 ] flagception.expression_language
[7 ] flagception.twig.toggle_extension
[8 ] flagception.profiler.feature_data_collector
[9 ] flagception.bag.feature_result_bag
[10] flagception.bag.feature_config_bag
[11] flagception.constraint.constraint_resolver
[12] flagception.factory.expression_language_factory
[13] flagception.constraint_provider.date_provider
[14] flagception.constraint_provider.match_provider
[15] flagception.activator.chain_activator
[16] flagception.decorator.chain_decorator
[17] flagception.listener.routing_metadata_subscriber
[18] flagception.activator.array_activator
[19] flagception.activator.constraint_activator
[20] flagception.activator.environment_activator
> 5
Information for Service "flagception.manager.feature_manager"
=============================================================
Class FeatureManager
---------------- -------------------------------------
Option Value
---------------- -------------------------------------
Service ID flagception.manager.feature_manager
Class Flagception\Manager\FeatureManager
Tags -
Public yes
Synthetic no
Lazy no
Shared yes
Abstract no
Autowired no
Autoconfigured no
---------------- -------------------------------------
from flagception-bundle.
If i inject the FeatureManager manually, it works too.
App\Foo\Bar:
arguments: ['@flagception.manager.feature_manager']
from flagception-bundle.
The same thing happens if I type-hint the FeatureManager instead of the FeatureManagerInterface.
Yes, the FeatureManger
is not aliased and should not work. But FeatureManagerInterface
should work. We use always flagception with autowire. I don't have to define this manually in any project until now. That's very strange.
Maybe it is because flagception.manager.feature_manager is not autowired / autoconfigured?
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).
from flagception-bundle.
Which version do you have installed?
from flagception-bundle.
Thank you for your help.
flagception/flagception 1.5.0
flagception/flagception-bundle 3.0.0
Symfony 4.4.5
from flagception-bundle.
I created an example repository which reproduces this issue:
https://github.com/dsentker/flagception-invalid-autowiring
The FeatureManagerInterface
injection is here: App\Service\FooService::__construct()
I created two simple tests to check if the service is injected correct. Alternatively, you can start the application with symfony serve
and use your browser to access the start page.
In addition I have the following comments:
- I first tried to use
symfony new xyz --full --version=4.4
. With this setup, i was not able to install this bundle with composer due to the following error. It seems that the ToggleExtension refers to the deprecated Twig_Extension class.
CRITICAL [php] Uncaught Error: Class 'Twig_Extension' not found ["exception" => Error { …}]
In ToggleExtension.php line 17:
!! Attempted to load class "Twig_Extension" from the global namespace.
!! Did you forget a "use" statement?
- I then copied the relevant parts of my composer.json, which I also use in my application (where the problem occurred). Then i was able to install your bundle.
- The entries from composer.json come from an installation of Symfony 4.1, which I then updated regularly with composer update up to version 4.4.5. But I don't think that's relevant.
I hope that helps!
from flagception-bundle.
OK, sorry for the comment spam, but i found the issue.
I installed your bundle with composer require flagception/flagception-bundle
. For a reason i do not know, composer decided to add the following line to my composer.json: "flagception/flagception-bundle": "3",
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 "flagception/flagception-bundle": "^3"
and now it works.
The only question that remains: Why does composer write the explicit reference to version 3.0.0 ("3") in the composer.json?
from flagception-bundle.
I created #76 to avoid misunderstandings (so, and now I'm no longer annoying) ;-)
from flagception-bundle.
Thanks for your work. ;-)
I think we can close this issue.
from flagception-bundle.
Related Issues (20)
- Dependency on old version of doctrine/annotations HOT 2
- env attribute isn't pulling from .env.* files
- Is this repository alive? HOT 8
- Environment Activator & Symfony 4.3+ "broken" HOT 3
- Flagception\Bundle\FlagceptionBundle\Profiler\FeatureDataCollector::collect declaration error in Symfony5 HOT 4
- Support for Twig 3. HOT 3
- Invoke Controllers HOT 1
- Symfony profiler doesn't show configured features HOT 3
- is there a way to list the features? HOT 3
- [RFC] Support latest Symfony LTS in master branch HOT 3
- TraceableChainActivator does not honor ChainActivator strategy HOT 1
- TraceableChainActivator is used despite the kernel debug mode HOT 2
- Activator based on environment values? HOT 1
- Symfony 6.0 support HOT 6
- php8 support
- Flagception psr cache compatibility HOT 3
- FeatureDataCollector should not be registered in kernel debug mode HOT 3
- Support PHP8 Attributes
- Enable service for symfony routing condition option
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flagception-bundle.