Granada\Orm\Wrapper::_get_instances PHP Method

_get_instances() protected method

Added: the array result key = primary key from the model Added: Eager loading of relationships defined "with()"
protected _get_instances ( array $rows ) : array
$rows array
return array
    protected function _get_instances($rows)
    {
        $instances = array();
        foreach ($rows as $current_key => $current_row) {
            $row = $this->_create_instance_from_row($current_row);
            $row = $this->_create_model_instance($row);
            $key = isset($row->{$this->_instance_id_column}) && $this->_associative_results ? $row->id() : $current_key;
            $instances[$key] = $row;
        }
        return $instances;
    }