code: public function _populate($record = null, $db = false, $loadMap = false)
      {
        // In order to stop unnecessary recursive issetExtended() checks while doing initial hydrating of model.
        $this->model_hydrating = true;
  
        // If this model is having a custom DB object passed into it,
        // then we'll use that for any dynamic fetching instead of
        // the connection defined on the model.
        // This is to facilitate using a Test database when running tests.
        if ($db) {
          $this->model_db = $db;
        }
  
        if($record) {
          // Populate model related data.
          $this->_populateAttributes($record);
  
          // Populate non-model related data.
          $this->_populateNonModelData($record);
        }
  
        // Populate data as mapped
        if ($this->model_loadMapsEnabled) {
          $this->_populateLoadMap($record, $loadMap);
        }
  
        // Call onLoad method 
        $this->onLoad();
  
        // If a custom onLoad function was given as part of a loadMap
        // Also call that
        if ($loadMap instanceof \Cora\Adm\LoadMap && $func = $loadMap->getOnLoadFunction()) {
          // Fetch any array of args passed along with the LoadMap
          $args = $loadMap->getOnLoadArgs();
  
          // Add a reference to this model as the first argument
          array_unshift($args, $this);
  
          // Call user provided onLoad closure
          call_user_func_array($func, $args); 
        }
  
        $this->model_hydrating = false;
  
        return $this;
      }
docs: Hydrates this model with data.
  
  @param array  $record   (optional) An associative array (like a row of data from a database).
  @param object $db       (optional) A Database object for fetching data.
  @param object $loadMap  (optional) An object that defines which data should be loaded and how.