From 0a601ffc6658732c209d700e8894cfff3dfb27f9 Mon Sep 17 00:00:00 2001 From: Tomasz Szadkowski Date: Wed, 29 Jul 2015 16:21:15 +0200 Subject: [PATCH] collection to array --- src/Cleeng/Entity/Base.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Cleeng/Entity/Base.php b/src/Cleeng/Entity/Base.php index 9f36aef..0ae0b80 100644 --- a/src/Cleeng/Entity/Base.php +++ b/src/Cleeng/Entity/Base.php @@ -41,6 +41,20 @@ public function populate($data) $this->pending = false; } + /** + * Convert collection into array + * + * @return array + */ + public function toArray() + { + $data = array(); + foreach ($this as $k => $v) { + $data[$k] = $v; + } + return $data; + } + /** * Class constructor *