public function asArray($fields = [], $valuesOnly = false, $flat = false)
    {
        if ($flat && 1 != count($fields)) {
            throw new TypeError(
                "'flat' is valid when asArray is called".
                ' with exactly one field.'
            );
        }
        if ($flat && !$valuesOnly) {
            throw new TypeError(
                "'flat' is valid when asArray ".
                'is called with valuesOnly=true.'
            );
        }
        $clone = $this->_clone();
        $clone->_fields = $fields;
        $clone->query->setValueSelect($fields);

        $clone->resultMapper = ($valuesOnly) ? ArrayValueMapper::class :
            ArrayMapper::class;
        if ($flat) {
            $clone->resultMapper = ArrayFlatValueMapper::class;
        }

        return $clone;
    }
public function asArray($fields = [], $valuesOnly = false, $flat = false)
    {
        if ($flat && 1 != count($fields)) {
            throw new TypeError(
                "'flat' is valid when asArray is called".
                ' with exactly one field.'
            );
        }
        if ($flat && !$valuesOnly) {
            throw new TypeError(
                "'flat' is valid when asArray ".
                'is called with valuesOnly=true.'
            );
        }
        $clone = $this->_clone();
        $clone->_fields = $fields;
        $clone->query->setValueSelect($fields);

        $clone->resultMapper = ($valuesOnly) ? ArrayValueMapper::class :
            ArrayMapper::class;
        if ($flat) {
            $clone->resultMapper = ArrayFlatValueMapper::class;
        }

        return $clone;
    }
public function asArray ( $ fields = [ ] , $ valuesOnly = false , $ flat = false ) { if ( $ flat && 1 != count ( $ fields ) ) { throw new TypeError ( "'flat' is valid when asArray is called" . ' with exactly one field.' ) ; } if ( $ flat && ! $ valuesOnly ) { throw new TypeError ( "'flat' is valid when asArray " . 'is called with valuesOnly=true.' ) ; } $ clone = $ this -> _clone ( ) ; $ clone -> _fields = $ fields ; $ clone -> query -> setValueSelect ( $ fields ) ; $ clone -> resultMapper = ( $ valuesOnly ) ? ArrayValueMapper :: class : ArrayMapper :: class ; if ( $ flat ) { $ clone -> resultMapper = ArrayFlatValueMapper :: class ; } return $ clone ; }
Returns the results as an array of associative array that represents a
record in the database.

The orm does not try map the into  there  respective models.

@param array $fields     the fields to select, if null all fields in the
model are selected
@param bool  $valuesOnly if true return
@param bool  $flat       if true returns the results as one array others
it returns results as array of arrays each
which represents a record in the database for the
selected field.
(only works when valueOnly is true)

@return Queryset

@since  1.1.0

@author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>

@throws TypeError
Returns the results as an array of associative array that represents a record in the database .