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

Has_many_pivot get_relate on model in subFolder #272

Open
vlatkoIT opened this issue Apr 24, 2018 · 0 comments
Open

Has_many_pivot get_relate on model in subFolder #272

vlatkoIT opened this issue Apr 24, 2018 · 0 comments

Comments

@vlatkoIT
Copy link

vlatkoIT commented Apr 24, 2018

I really appreciate the existence of this "model" library and recently tried and successfully integrated it in my Codeigniter 2 project. Maybe this issue is because I customized something or because I tend to keep my models organized in subfolders.

I created has_many_pivot relationship between two tables, with a pivot table containing only the two ids. What I had issue with was the foreign_model field, which is in a subfolder, so the string looks something like this subfolder/users_model. And I suppose you will understand what happens when you place the sting in this code:
$subs[$the_local_key][$the_foreign_key] = $this->{$relation['foreign_model']}->where($foreign_key, $result[$foreign_key])->get();

Basically, the system was looking for $this->subfolder/users_model->where(...), but then I changed from $relation['foreign_model'] to $relation['foreign_model_name'] and everything was fixed.
I don't know if this helps with anything, or if it is a bug fix as well, I thought to share it

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

No branches or pull requests

1 participant