public function fetchAll($params = [])
    {
        return $this->table->select(
            function (Select $select) {
                $select->columns([]);
                $select->join(
                    $this->roleTableName,
                    sprintf('%s.role_id=%s.role_id', $this->roleTableName, $this->table->getTable())
                );
                $select->where(['user_id' => $this->getUserId()]);
            }
        );

//        $adapter = new DbSelect($select, $this->table->getAdapter());
//        return new $this->collectionClass($adapter);
    }
public function fetchAll($params = [])
    {
        return $this->table->select(
            function (Select $select) {
                $select->columns([]);
                $select->join(
                    $this->roleTableName,
                    sprintf('%s.role_id=%s.role_id', $this->roleTableName, $this->table->getTable())
                );
                $select->where(['user_id' => $this->getUserId()]);
            }
        );

//        $adapter = new DbSelect($select, $this->table->getAdapter());
//        return new $this->collectionClass($adapter);
    }
public function fetchAll ( $ params = [ ] ) { return $ this -> table -> select ( function ( Select $ select ) { $ select -> columns ( [ ] ) ; $ select -> join ( $ this -> roleTableName , sprintf ( '%s.role_id=%s.role_id' , $ this -> roleTableName , $ this -> table -> getTable ( ) ) ) ; $ select -> where ( [ 'user_id' => $ this -> getUserId ( ) ] ) ; } ) ; //        $adapter = new DbSelect($select, $this->table->getAdapter()); //        return new $this->collectionClass($adapter); }
Fetch all or a subset of resources

@param  array $params
@return \Zend\Db\ResultSet\ResultSet
Fetch all or a subset of resources