-
Notifications
You must be signed in to change notification settings - Fork 84
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
Problem when joining the same table multiple times #106
Comments
maybe the best solution is to add counter :
|
It would be like solution 2, adding a counter before the sha1 is generated in case of use hash, I will check in which part of the code would be the best place to do it, but if you already know, please guide me with a line number or function name :) |
If you say that we should have two tables in our app, I do not see it as a good practice, because it would be necessary to have duplicated information, since I think that better will be to resolve it in the package code. |
Real random table alias string (resolve #106)
Hello,
Sometimes there are relationship like the following:
Tables:
user
countries
country_in
country_out
If the model relationship is like
user -> country_in -> countries
|-> country_out -> countries
we have this query generated
which throw
"SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'countries'
I am thinking how to resolve it, and I have few ideas that I would like to discuss which one is the best or maybe can be another solution in order to resolve the problem:
Add a new property like
$useTableUniqueAlias
and in EloquentJoinBuilder.php:184 check for that flag and add a randomsalt
to the sha1.Other idea could be to check in all the relationship if the table is duplicated and also generate a unique sha1 for each one.
Directly use random hash instead of sha1 (I have to see better the code if it could have issues with other parts)
Any other solution?
Cheers
The text was updated successfully, but these errors were encountered: