system/classes/Collection.php
public function toArray()
    {
        $collection = $this->getIterator();
        $plainArray = [];

        foreach($collection as $prop => $result) {
            if (is_object($result) && method_exists($result, 'toArray')) {
                $plainArray[] = $result->toArray();
            } else {
                $plainArray[] = $result;
            }
        }
        return $plainArray;
    }
public function toArray()
    {
        $collection = $this->getIterator();
        $plainArray = [];

        foreach($collection as $prop => $result) {
            if (is_object($result) && method_exists($result, 'toArray')) {
                $plainArray[] = $result->toArray();
            } else {
                $plainArray[] = $result;
            }
        }
        return $plainArray;
    }
Attempts to return the collection as a simple array.

@return array