Small issue in ORM relations (1.8) - I have this :
$data['u'] = Model_Users_Collaborator::query()
->where($where)
->related(['schedule'])
->get_one();
When I dump the obect, I see the schedule relation, no problem. But in the profiler I see another query under the main one :
SELECT `t0`.`id` AS `t0_c0`, `t0`.`collaborator_id` AS `t0_c1`, `t0`.`start` AS `t0_c2`, `t0`.`end` AS `t0_c3`, `t0`.`created_at` AS `t0_c4`, `t0`.`updated_at` AS `t0_c5` FROM `users_collaborators_schedules` AS `t0` WHERE `t0`.`collaborator_id` = '114'
Like if the relation wasn't called in the query, same as lazy load mechanism.
I wouldn't know why that would happen with that specific query.
Was that collaborator record already fetched and loaded from cache perhaps, which the cached version not having the relation loaded?
Can you test it in case where you are absolutely sure it is the only query that runs? And when done, can you run that test again, but than against 1.9/develop of the ORM package?
to disable caching on a per-query basis. In 1.9/develop, you can disable the cache completely, using config, and use
->from_cache(true)->
to explicitly cache the query.
In general, it is worth while to think about how you query, since caching (and retrieving objects from cache) is a huge timesaver and a boost to the performance of your apps.