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

Grocery_crud_model.php #480

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Grocery_crud_model.php #480

wants to merge 1 commit into from

Conversation

omv58
Copy link

@omv58 omv58 commented Sep 5, 2019

Fix of a bug if the table column are ambiguous.

Fix of a bug if the table column are ambiguous.
@scoumbourdis
Copy link
Owner

Hello @omv58,

Can you please provide an example of what this code is fixing? Unfortunately I can't merge this code as I can't understand what problem is trying to solve.

For example the code that didn't work for you and what was the expected behaviour.

Regards
Johnny

@mckaygerhard
Copy link

mckaygerhard commented Sep 23, 2019

hi @scoumbourdis i guess the ambigous table column is a very old problem in GC, this solves partially that situation when tje join happened for relationship and two columns are equal and the search doe snot work

@omv58
Copy link
Author

omv58 commented Sep 30, 2019

The fix applies when you have 2 tables with a column with the same name. When this happens, the search does not work. The solution only references the table whose column is: $this->table_name. '.'. $Field.

@scoumbourdis
Copy link
Owner

Unfortunately It seems that the fix doesn't work as it has issues with the set_relation function. For example the line here: https://github.com/scoumbourdis/grocery-crud/blob/master/application/libraries/Grocery_CRUD.php#L608 that it is using the table_name as the field name. I will try to find some time to investigate on the issue so I can provide another solution.

@mckaygerhard
Copy link

hi @scoumbourdis this issue is still happened! i just discovered we can fixid by using $field_info->relation_table in the join code at get_relation_n_n_selection_array when performed the $this->db->where and in same way of db_relation_n_n_update and db_relation_n_n_delete

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.

3 participants