• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cache with custom_row_object

#1
Hello folks,

I have a question because of the cache. I enabled it in our application and now a query in this format doesn't work anymore:
PHP Code:
$this->CI->db->where('customModelId'$customModelId)->get('custom-table')->row(0'customModel'); 

(We need $this->CI for the session, that's okay like this)

The thing is, I found out that if the data is loaded from the cache, there is no conn_id and no result_id set in the result, which makes perfectly sense. The thing is, if you call row() with a custom model, it will call custom_row_object which will call custom_result_object. In this function there is this if condition:
PHP Code:
elseif ( ! $this->result_id OR $this->num_rows === 0) {
     return array();

This leads to error messages even if the correct data would be loaded. Did anyone else had this problem and has a workaround, which is not in the DB_result.php class? I don't like to mess around in system classes. I use CI 3.1.10.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.