
 alexandru traian - 2015-03-20 17:53:23
 
if add this method
public function get_obj() {
    return $this->_execute($this->query_builder(), $this->_data, 'obj');
}
and modify 
private function _execute($query = null, $values = array(), $fetch = 'All') {
        
        if ( is_null($query) )
                return false;
        $result = array();
        $sth    = $this->prepare($query);
        if ( $sth->execute(array_values(array_filter($values, 'strlen'))) ){
            if ( $this->_insert || $this->_update || $this->_delete ){
                $this->clear();
                return TRUE;
            }
            if ( $fetch == 'All' ){
                    $result = $sth->fetchAll();
            }else if( $fetch == 'assoc' ){
                    $result = $sth->fetch(PDO::FETCH_ASSOC);
            }else if( $fetch == 'obj' ){
                $result = $sth->fetchAll(PDO::FETCH_OBJ);
            }
        }
        if ( $result )
                array_map(array($this, 'map_count'), $result);
        $this->clear();
        return $result;
    }
I can extract obj from class.
in model i have
public function login_user() {
        
        self::$instance = DB_Manager::get_instance($_POST)->database();
        self::$instance->table = 'users';
        $pwd = hash(............);
        $log = self::$instance->select('*')->where('username', $this->data['user'])->where('password', $pwd)->get_obj();
        if(self::$instance->get_result_count() == 1){
            return $log;
         }
         return false;
    }
the rest 
public function login() {
        
        if (........) {
            ...........
            $row = $this->model('Users', 'login_user');
            if(!$row){
                ...........
            }
            $this->session->auth_user($row);
            URL::to(SITE_ROOT."/users/login_area");
            exit;
        }
public function auth_user($row){
        foreach($row as $row):
            $_SESSION['user'] = $row->username;
            $_SESSION['user_id'] = $row->id_user;
            ..............
            $_SESSION ['id'] = sha1(..........);
        endforeach;
    }