Replies: 1 comment
-
I didn't get a response, but 2 upvotes. Maybe I should open a PR |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When a
ServiceProvider
implements theDeferrableProvider
interface, it is registered only when one of the services declared in itsprovides()
method is built.Problem
My issue is to extend one of this services in a
DeferrableProvider
provided by my package. If I add the service name in the "provides" list, it replaces the originalCoreServiceProvider
. So I can't extend it. I could only redefine it with$app->singleton()
.If the service name is not in the "provides" list, my provider is never registered.
Partial solution
My current solution is to explicitly call the
CoreServiceProvider
fromMyPackageServiceProvider
. But this is not 100% safe as an other package could extend the same service. It would not be registered either.Actually implemented in mongodb/laravel-mongodb#3071
Proposition
All the service providers providing a service should be called. Instead of having a single provider per service name, it should be a list:
framework/src/Illuminate/Foundation/ProviderRepository.php
Line 149 in b18f333
And all the associated providers would be registered when the service is built.
Beta Was this translation helpful? Give feedback.
All reactions