-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
fix: use qualifyColumn rather than assuming format #53559
Conversation
@@ -378,8 +379,9 @@ public function getRelation($parent = null, $builder = null) | |||
$this->builder = $builder ?: m::mock(Builder::class); | |||
$this->builder->shouldReceive('where')->with('relation.id', '=', 'foreign.value'); | |||
$this->related = m::mock(Model::class); | |||
$this->related->shouldReceive('getKeyName')->andReturn('id'); | |||
$this->related->shouldReceive('getcolumn')->andReturn('id'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be getColumn
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't really matter. method names are not case sensitive.
This PR broken |
This reverts commit cff895d.
…53568) * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * Revert "fix: use qualifyColumn rather than assuming format (#53559)" This reverts commit cff895d. * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> --------- Signed-off-by: Mior Muhammad Zaki <[email protected]>
This PR has been reverted due as it triggers error on certain |
In my setup I have some Laravel models stored in MongoDB and others in MySQL. MorphTo and BelongsTo relations aren't loading where the parent model is in MongoDB and the child is in MySQL, i.e:
Child::first()->myRelation
will returnnull
becauseaddConstraints()
is assuming that the key name should be prepended with the table name, which isn't the case for MongoDB.The
getQualifiedOwnerKeyName()
method already exists on the BelongsTo class, is there any reason why it's not currently being used when adding constraints?