Fetch the model's views

@throws \InvalidArgumentException Database view is defined without columns

@return  array
514656
public static function views()
	{
		$class = get_called_class();

		if ( ! isset(static::$_views_cached[$class]))
		{
			static::$_views_cached[$class] = array();
			if (property_exists($class, '_views'))
			{
				$views = $class::$_views;
				foreach ($views as $k => $v)
				{
					if ( ! isset($v['columns']))
					{
						throw new \InvalidArgumentException('Database view '.$k.' is defined without columns.');
					}
					$v['columns'] = (array) $v['columns'];
					if ( ! isset($v['view']))
					{
						$v['view'] = $k;
					}
					static::$_views_cached[$class][$k] = $v;
				}
			}
		}

		return static::$_views_cached[$class];
	}
979973
public function getColumns()
    {
        $columns = array();

        foreach ($this->_columns as $name => $column) {
            $columns[$name] = $this->getColumn($name);
        }

        return $columns;
    }
1281707
public function listDatabases()
    {
        $sql = $this->_platform->getListDatabasesSQL();

        $databases = $this->_conn->fetchAll($sql);

        return $this->_getPortableDatabasesList($databases);
    }
1144850
public function fetchAll()
    {
        $query = sprintf('SELECT * FROM `%s`', $this->table);
        $result = array();

        foreach ($this->pdo->query($query) as $key => $value) {
            $result[$key] = $value;
        }

        return $this->parse($result);
    }
266504
public function getColumns()
    {
        $table = $this->table()->connect($this->database, Inflector::tabilize($this->model));

        return $table->{__FUNCTION__}();
    }
616844
public static function getColumns()
    {
        $cls = get_called_class();
        if (!array_key_exists($cls, self::$_columns)) {
            return null;
        }
        return self::$_columns[$cls];
    }
672455
public function fetch()
    {
        $ret = array();
        $pos = 0;
        $len = count($this->_arguments);

        foreach ($this->_descriptors as $name => $descriptor) {
            $value = $descriptor->getDefault();

            for ($i = $pos; ; $i++) {
                if ($i < $len && $descriptor->match($this->_arguments[$i])) {
                    $value = $this->_arguments[$i];
                    $pos = $i + 1;
                    break;
                } else {
                    if ($descriptor->isRequired()) {
                        throw new InvalidArgumentException(
                            "Argument is required: `$name`"
                        );
                    }
                    if ($i > $len - 1) {
                        break;
                    }
                }
            }

            $ret[$name] = $value;
        }

        return $ret;
    }
1260837
public function fetchData($columns = null)
    {

        // auto populate columns with arrays from the existing Table
        // when user does not supply a parameter to this function
        if($columns == null)
        {
            $this->_selectedColumns = $this->getTableColumns();
        }
        else
        {
            if(is_array($columns))
            {
                $this->_selectedColumns = $columns;
            }
            else
            {
                throw new \InvalidArgumentException('Invalid argument provided on Column parameter');
            }
        }

        $select = new Select();

        $select->columns(array_keys($this->_selectedColumns));
        $select->from($this->tableGateway->getTable());
        $resultSet = $this->tableGateway->selectWith($select);
        $resultSet->buffer();
        $this->_selectedValues = $resultSet;

        return $resultSet;

    }
32899
private function fetchRow()
    {
        $row = pg_fetch_array($this->result, null, PGSQL_ASSOC);

        if (empty($row)) {
            return $row;
        }

        return $this->convertColumns($row);
    }
845657
public function fetchAll(): array
    {
        if (!$this->wasExecuted()) {
            $this->exec();
        }

        return $this->getAdapter()->getStatement()->fetchAll(PDO::FETCH_ASSOC);
    }
625088
protected function getSelectColumns() {
		//obtain attributes from config
		if ($this->hasOption('query.attrs')) {
			$columns = [];
			
			foreach ($this->getOption('query.attrs') as $attr) {
				if ($attr instanceof Attr)
					$name = $attr->getName();				
				elseif (is_string($attr))
					$name = $attr;
				else
					throw new \InvalidArgumentException("Method 'attrs' expects a list of strings or instances of \eMapper\Query\Attr");
				
				if (!$this->entityProfile->hasProperty($name))
					throw new \InvalidArgumentException(sprintf("Attribute '%s' not found in class '%s'", $name, $this->entityProfile->getReflectionClass()->getName()));
				
				$column = $this->entityProfile->getProperty($name)->getColumn();
				if (!array_key_exists($column, $columns))
					$columns[$column] = new Column($column);
			}
			
			return $columns;
		}
	
		return $this->selectColumns;
	}
1127287
public function getViewNames()
    {
        $names = $this->query(
            'SELECT table_name FROM information_schema.tables WHERE table_schema=? AND table_type=?',
            array(
                $this->getTableSchema(),
                'VIEW'
            )
        );
        // Flatten array
        foreach ($names as &$name) {
            $name = $name['table_name'];
        }
        return $names;
    }
38384
private function getDatabaseStructureViews()
    {
        // Listing all views from database
        if (empty($this->dumpSettings['include-views'])) {
            // include all views for now, blacklisting happens later
            foreach ($this->dbHandler->query($this->typeAdapter->show_views($this->dbName)) as $row) {
                array_push($this->views, current($row));
            }
        } else {
            // include only the tables mentioned in include-tables
            foreach ($this->dbHandler->query($this->typeAdapter->show_views($this->dbName)) as $row) {
                if (in_array(current($row), $this->dumpSettings['include-views'], true)) {
                    array_push($this->views, current($row));
                    $elem = array_search(
                        current($row),
                        $this->dumpSettings['include-views']
                    );
                    unset($this->dumpSettings['include-views'][$elem]);
                }
            }
        }
        return;
    }
799373
protected function fetchLazy()
    {
        if ($this->columnData && $this->columnNamesWithPrefix && $this->columnNames){
            return;
        }
        $this->columnNames = [];
        $this->columnNamesWithPrefix = [];
        foreach ($this->getColumnData() as $value) {
            $this->columnNamesWithPrefix[$value['Field']] = "`$this->prefix`.`{$value['Field']}`";
            $this->columnNames[] = $value['Field'];
        }
    }
308931
public function get(): array
    {
        try {
            $query = $this->apply($this->database->getTablePrefixer());
            $compiled = $this->database->getGrammar()->compileSelect($query);
            return $this->database->select($compiled->getSQL(), $compiled->getBindings());
        } catch (\Throwable $exception) {
            return $this->handleException($exception);
        }
    }
1125822
public function fetchColumnAttributes()
    {
        if ( !is_object($this->datasource) )
            return false;

        $conn = $this->datasource->ado_connection;
        //$a = new Reportico($this->datasource);
        //$old_database = $a->database;

        $datadict = false;
        reset($this->columns);
        $lasttab = "";
        while ($d = key($this->columns)) {
            $value = &$this->columns[$d];

            if (array_key_exists($value->query_name, $this->clone_columns)) {
                $value->column_type =
                $this->clone_columns[$value->query_name][0];
                $value->column_length =
                $this->clone_columns[$value->query_name][1];

            } else if ($value->table_name) {
                if ($lasttab != $value->table_name) {
                    $datadict = $this->datasource->ado_connection->MetaColumns($value->table_name);
                    if (!$datadict) {
                        // echo "Data Dictionary Attack Failed Table $value->table_name\n";
                        // echo "Error ".$this->datasource->ado_connection->ErrorMsg()."<br>";
                        //die;
                    }
                }
                foreach ($datadict as $k => $v) {

                    if (strtoupper(trim($k)) == strtoupper($value->column_name)) {
                        //$coldets = $datadict[strtoupper($value->column_name)];
                        $coldets = $datadict[$k];
                        $value->column_type =
                        ReporticoDataSource::mapColumnType(
                            $this->datasource->driver,
                            $datadict[$k]->type);

                        if (strtoupper($value->column_type) == "INTEGER") {
                            $value->column_length = 0;
                        } else if (strtoupper($value->column_type) == "SMALLINT") {
                            $value->column_length = 0;
                        } else {
                            $value->column_length = (int) $datadict[$k]->max_length;
                        }

                        break;
                    }
                }
            }
            $lasttab = $value->table_name;
            next($this->columns);
        }
    }
1092804
public function fetch(): array
    {
        $sql = $this->builder->buildSql();
        $this->builder = new QueryBuilder($this->pdo);
        return $this->fetchBySql($sql);
    }