Open EVILoptimist opened 9 years ago
@shmax Do you hate me yet :scream:
Nice find, that's definitely a bug in my book.
I think the best way to start with this is a failing test case.
Yes, if you open a PR with a test case I'll take a look. I've never worked with eager loading (and only rarely with associations), so in this case you're more familiar with the code than I am.
In an effort to cut down build times on my scripts, I've been going through a LOT of SQL logs, and I found an incompatibility with Model caching and eager loading.
When I have caching enabled on my Models and run this:
I get this in my SQL logs:
When, really, these should be pulled from cache, right? The Company record is being pulled from cache, then the rest are queried N+1 style.
Then, I disable caching in the Model classes, with the same PHP code, I get this in my SQL logs:
Anyone more familiar with the code than I have any ideas?