[8.x] Resolve Blueprint class out of the container #40307
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, it is almost impossible to swap the
Blueprint $table
implementation for migrations with a fake one from within a "package space".Because the
Schema
facade returns a new object each time from thegetFacadeAccessor
method (hence there is no way of mocking or hot swapping) and non of the other objects are resolved out of the container. (Connection objects or Builder objects)There is also no change of using the
resolver
property on theBuilder
class from a package space because if you set it before the migration starts it will be thrown away after theSchema
is called in the migration.Currently "illuminate/database" depends on "illuminate/container" so we can use the Container class directly. (if not wrong)
This way it is possible to swap the Blueprint class upon the
registration phase
.