Skip to content

Commit a6e70b7

Browse files
authored
Merge pull request #36 from thomseddon/fix/return-native-array
Convert all ArrayObjects to native arrays [Trying to solve broken down migrations]
2 parents 2548d00 + c645407 commit a6e70b7

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/Query.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,21 @@ public function run($query = null)
6666
$time = $this->connection->getElapsedTime($start);
6767
$this->connection->logQuery($query, [], $time);
6868

69-
return $result;
69+
return $this->nativeArray($result);
70+
}
71+
72+
private function nativeArray($val)
73+
{
74+
if (is_array($val)) {
75+
foreach ($val as $k => $v) {
76+
$val[$k] = $this->nativeArray($v);
77+
}
78+
79+
return $val;
80+
} elseif (is_object($val) && $val instanceof \ArrayObject) {
81+
return $val->getArrayCopy();
82+
} else {
83+
return $val;
84+
}
7085
}
7186
}

0 commit comments

Comments
 (0)