-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Register the Mongo driver through the make function instead of resolving function #2715
Comments
Hello @zyz954489346, do you have any idea how we can fix this issue? |
Hi @zyz954489346, I believe the issue is actually in your code. Quoting from the Service Providers documentation:
In your code, you are registering a listener, which you shouldn't be doing in
|
@alcaeus You're right, but there's no way to let other package writers to do that. Another thing I don't understand is why you register through the resolving function instead of the make function. I read other similar packages, most of which are register through the make function. |
@GromNaN I temporarily solved the problem by rewriting Provider, but this is really not an elegant solution. |
I agree. The specification says to not request dependencies in
The Like I said: if tools break because do what a bolded sentence in the docs tells them not to do, that's not on us, that's on them. I'm closing this as won't fix. |
i hit the same problem until i close the laravel-sql-logger package, thx |
Description:
Register the Mongo driver through the make function instead of resolving functiong
If db is instantiated in another package, then the callback function registered through resolving function will not be executed, which is a hidden BUG.
This problem does not occur stably, only if a package is sorted by the composer and executes its own provider before the laravel-mongodb provider, and exactly instantiates db.
The core code is:
In my project, the following code exists in other packages, which can lead to problems. Because db is instantiated in advance:
Problems caused by,there is an error:
Unsupported driver [mongodb]. - InvalidArgumentException
The text was updated successfully, but these errors were encountered: