Skip to content

Fixes the join problem #218

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

Merged
merged 3 commits into from
Mar 27, 2018
Merged

Fixes the join problem #218

merged 3 commits into from
Mar 27, 2018

Conversation

SlyDeath
Copy link
Contributor

When SQL error "key" is ambiguous

When SQL error "key" is ambiguous
@lazychaser
Copy link
Owner

This is incompatible with previous versions of Laravel that doesn't have getQualifiedKeyName. If you fix this, I'll merge then

@SlyDeath
Copy link
Contributor Author

Done

@@ -86,7 +86,7 @@ public function whereIsRoot()
*/
public function whereAncestorOf($id, $andSelf = false, $boolean = 'and')
{
$keyName = $this->model->getKeyName();
$keyName = $this->model->getTable() . '.' . $this->model->getKeyName();
Copy link

@oujesky oujesky May 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a problem here, as $keyName is also used below on line 103 in subquery and this needs to be in form of really just the key column name. If the table name is specified here, it won't work as the table is referenced by alias _ in the subquery.

$keyName should stay as is and the table name should be added only on line 117, where it is the only place where it is actually needed and prevents Column '...' in where clause is ambiguous . errors.

That is also possibly the cause why the build if failing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@tortuetorche
Copy link

Hi,

Any news of this pull request?
By the way, this package is amazing 👍

Cheers,
Tortue Torche

@lazychaser lazychaser merged commit b570bc6 into lazychaser:v4 Mar 27, 2018
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.

4 participants