From c645407d15c6cc768707c4e690e6232e38ace20e Mon Sep 17 00:00:00 2001 From: Thom Seddon Date: Fri, 19 Aug 2016 15:24:18 +0100 Subject: [PATCH] Convert all ArrayObjects to native arrays --- src/Query.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Query.php b/src/Query.php index 4a0da19..26b11b2 100644 --- a/src/Query.php +++ b/src/Query.php @@ -66,6 +66,21 @@ public function run($query = null) $time = $this->connection->getElapsedTime($start); $this->connection->logQuery($query, [], $time); - return $result; + return $this->nativeArray($result); + } + + private function nativeArray($val) + { + if (is_array($val)) { + foreach ($val as $k => $v) { + $val[$k] = $this->nativeArray($v); + } + + return $val; + } elseif (is_object($val) && $val instanceof \ArrayObject) { + return $val->getArrayCopy(); + } else { + return $val; + } } }