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.
Description
One of my packages, reedware/laravel-relation-joins received an issue report (#34) indicating that it was partially incompatible with your project.
Upon further investigation, I saw that the root cause was the
getTable
method on models being overridden in such a way thatsetTable
is no longer respected.My package allows you to join on relations by name, and sometimes those joins need to be aliased, like so:
When an alias is used in my package, the underlying implementation is to swap out the table name of the model with the aliased counterpart so that any qualified constraints are bound against the aliased table, rather than the original one. This relies on the ability to set a model's table during runtime that doesn't reflect the actual model's table, but rather an alias in a query that's actively being constructed.
However, because your implementation of
getTable
does not supportsetTable
, the approach in my package falls apart, as it needs to be able to rely onsetTable
. Thankfully, the fix is quite simple. Functions like this:Just need to become this:
This PR updates all overrides of
getTable
to follow suit, thus resolving the partial incompatibility between our two projects.