Comments (3)
The problem here is that the container doesn't know where to find the tag.
Are all definitions for that tag in the same service provider? If so, add the tag name to 'provides' and it will resolve it correctly.
If the definitions are spread across multiple service providers, that may not work as expected, so I'd suggest implementing the bootable service provider for those, and moving those particular definitions to the boot method.
I will give this a bit more attention when I have time as it's made me see the issue with spreading tagged definitions across multiple service providers.
Hope this helps and I will keep you updated.
from container.
Thank you for the fast answer!
The definitions are indeed spread into multiple service providers, as each service has multiple definitions, including one or more subscriber
in the way the app is built right now.
I'm going to take a look at using the bootable service provider for the tagged definitions, this could be a good workaround for now.
from container.
The problem with them being spread, is that service providers are lazily loaded and the container determines what to register based on the alias requested... which works great in most cases, but, once it finds a service provider that 'provides' the requested alias, it stops at that one. But that obviously becomes a problem if it's a tag and there are more definitions in service providers that it won't reach.
This is something I'd not thought of before so thanks for the report, I'll solve it the as soon as I can.
The boot method of a bootable service provider is eagerly loaded, so that will solve your problem and you won't need to add the tag to 'provides', it's not necessarily a workaround as such, but being able to lazy load is obviously better.
from container.
Related Issues (20)
- References are unallowed HOT 1
- Can't override a definition.
- Setting concrete does not reset arguments. HOT 4
- [2.x] Add support for PHP 8 HOT 2
- Extends causing an infinite loop HOT 1
- Inconsistent Behavior HOT 12
- Fatal error: incompatible declaration of get method against PSR interface, in some PHP versions HOT 5
- Returning from an inflector HOT 7
- Support for non-object concrete values HOT 3
- Question: How to "inflect once" for shared services? HOT 13
- Preceeding slash confusing fully qualified class names HOT 1
- Extends causing an infinite loop HOT 2
- Question: Can Container Change an Alias? HOT 1
- Huge performance hits when having a bigger application with a lot of service definitions HOT 6
- How swap added definition HOT 1
- Auto wiring a shared dependency HOT 1
- Infinate loop in resolving non-existant class HOT 1
- Question: How to achieve autowiring inside the service provider? HOT 1
- Is this package still maintained? HOT 5
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 container.