codeigniter-base-model icon indicating copy to clipboard operation
codeigniter-base-model copied to clipboard

Feature/eager relations

Open zbrox opened this issue 12 years ago • 1 comments

Currently if you have to pull n records with a relation to some other object that would result in n+1 queries to the database. With eager loading of relations you would have a constant number of 2 queries being run. I would appreciate it if somebody can take a look at the tests, because most of my time was not spent on the feature but producing the tests. I would constantly have method not found errors on "where_in" even when I mocked it (seemingly) properly and used it on the next line to test it if it's mocked ok. So I'm kinda nervous that I botched the tests somehow. I tried to make sure they test the proper things, but with this "where_in" error driving me mad I could finish producing the test ensuring only 1 query is run on the relation even when no results are being returned by it.

zbrox avatar Feb 24 '13 14:02 zbrox

This would be amazing to have! Does this handle nested relations?

Ex. Client has many Posts has many Comments

rreynier avatar Apr 28 '14 21:04 rreynier