Skip to content
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 the way join keys are set for a relation that's instance of HasManyThrough #22

Merged
merged 1 commit into from
Apr 14, 2020

Conversation

crlcu
Copy link

@crlcu crlcu commented Dec 13, 2019

A user can specify a different secondLocalKey.
The current implementation is always looking for the getQualifiedKeyName of the parent which assumes is the value returned by getKeyName

protected function getJoinKeys(Relation $relation)
{
    ...

    if ($relation instanceof HasManyThrough) {
        $fk = $relation->getQualifiedFarKeyName();

        return [$fk, $relation->getParent()->getQualifiedKeyName()];
    }
}

In this new version, it's going to look at the $relation->getQualifiedParentKeyName() which is retrieved based on the value that was set for secondLocalKey when the relation was defined.

@crlcu
Copy link
Author

crlcu commented Dec 23, 2019

Any idea when/if this will be merged?

@jarektkaczyk jarektkaczyk merged commit f2d8aa0 into jarektkaczyk:master Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants