system/classes/Model.php
protected function _populateNonModelData($record)
    {
      $nonObjectData = array_diff_key($record, $this->model_attributes);
      if (count($nonObjectData) > 0) {
        foreach ($nonObjectData as $key => $value) {

          // Note that if the model is using custom field names, this will result in a piece of data 
          // getting set to both the official attribute and as non-model data. 
          // I.E. If 'field' is set to 'last_modified' and the attribute name is 'lastModified', 
          // the returned value from the Gateway will get assigned to the attribute in the code above like so: 
          // $model->lastModified = $value 
          // However because it's not worth doing a backwards lookup of the form $this->getAttributeFromField($recordKey) 
          // (such a method would have to loop through all the attributes to find a match) 
          // The data will also end up getting assigned here like so: 
          // $model->last_modified = $value 
          // An extra loop per custom field didn't seem worth the savings of a small amount of model memory size/clutter.
          $this->$key = $value;
        }
      }
    }
protected function _populateNonModelData($record)
    {
      $nonObjectData = array_diff_key($record, $this->model_attributes);
      if (count($nonObjectData) > 0) {
        foreach ($nonObjectData as $key => $value) {

          // Note that if the model is using custom field names, this will result in a piece of data 
          // getting set to both the official attribute and as non-model data. 
          // I.E. If 'field' is set to 'last_modified' and the attribute name is 'lastModified', 
          // the returned value from the Gateway will get assigned to the attribute in the code above like so: 
          // $model->lastModified = $value 
          // However because it's not worth doing a backwards lookup of the form $this->getAttributeFromField($recordKey) 
          // (such a method would have to loop through all the attributes to find a match) 
          // The data will also end up getting assigned here like so: 
          // $model->last_modified = $value 
          // An extra loop per custom field didn't seem worth the savings of a small amount of model memory size/clutter.
          $this->$key = $value;
        }
      }
    }
For handling data that is not defined on this model...

If a custom query was passed in to the repository (that had a JOIN or something)
and there was extra data fetched that doesn't directly belong to the model,
we'll assign it to a normal model property here. This data will obviously
NOT be saved if a call is later made to save this object.

@param array $record An associative array (like a row of data from a database).
@return void