From 5f6a454e6a8e807e6a451680cc294f8cecacd8c8 Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Fri, 25 Dec 2015 06:51:24 +0300 Subject: [PATCH] toArray in SqlResultCollection --- Model/SqlResultCollection.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Model/SqlResultCollection.php b/Model/SqlResultCollection.php index 3157b8c..50a96f8 100644 --- a/Model/SqlResultCollection.php +++ b/Model/SqlResultCollection.php @@ -1,6 +1,8 @@ items); return $sql_result_provider->assoc($field, $assoc_as_array); } + + /** + * Get the collection of items as a plain array. + * + * @return array + */ + public function toArray() + { + return array_map(function($value) + { + return $value instanceof ArrayableInterface ? $value->toArray() : $value; + + }, $this->items); + } } \ No newline at end of file