title: Return array of model objects instead of array of arrays in CodeIgniter 3
body: <p>I have a CodeIgniter model:</p>
  
  <pre><code>&lt;?php
  class Person_model extends CI_Model {
      public function __construct() {
          $this-&gt;load-&gt;database();
      }
  
      public function list_persons() {
          $query = $this-&gt;db-&gt;get('persons');
          return $query-&gt;result_array();
      }
  
      public function foobar() {
          return 'Custom function here';
      }
  }
  ?&gt;
  </code></pre>
  
  <p>The function <code>list_persons()</code> is quite self-explained. It fetches all results from <code>persons</code> database table. </p>
  
  <p>Currently it returns results in a list of arrays, like this:</p>
  
  <pre><code>array(2) {
    [0] =&gt; array(3) {
      ["id"] =&gt; string(1) "1"
      ["first_name"] =&gt; string(6) "Test 1"
    }
    [1] =&gt; array(3) {
      ["id"] =&gt; string(1) "2"
      ["first_name"] =&gt; string(6) "Test 2"
    }
  }
  </code></pre>
  
  <p>Is it possible to let the function <code>list_persons()</code> to return:</p>
  
  <pre><code>array(2) {
    [0] =&gt; Person_model {
      "id" =&gt; 1
      "first_name" =&gt; "Test 1"
    }
    [1] =&gt; Person_model {
      "id" =&gt; 2
      "first_name" =&gt; "Test 2"
    }
  }
  </code></pre>
  
  <p>so that I can use the custom functions I wrote in the <code>Person_model</code>, such as:</p>
  
  <pre><code>foreach($this-&gt;person_model-&gt;list_persons() as $person) {
      echo $person-&gt;foobar();
  }
  </code></pre>
  
  <p>Thanks in advance.</p>