You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/02/06 22:20:38 UTC

[2/7] git commit: Added serialize method to collections

Added serialize method to collections


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/11917f24
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/11917f24
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/11917f24

Branch: refs/pull/30/merge
Commit: 11917f24d6d9295595c97d2414689ccecbb93fd0
Parents: 80c4ddd
Author: ryan bridges <rb...@apigee.com>
Authored: Sat Feb 1 14:50:59 2014 -0500
Committer: ryan bridges <rb...@apigee.com>
Committed: Sat Feb 1 14:50:59 2014 -0500

----------------------------------------------------------------------
 .../php/lib/vendor/Apigee/Usergrid/Collection.php | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/11917f24/sdks/php/lib/vendor/Apigee/Usergrid/Collection.php
----------------------------------------------------------------------
diff --git a/sdks/php/lib/vendor/Apigee/Usergrid/Collection.php b/sdks/php/lib/vendor/Apigee/Usergrid/Collection.php
index cefa43b..9b49d38 100644
--- a/sdks/php/lib/vendor/Apigee/Usergrid/Collection.php
+++ b/sdks/php/lib/vendor/Apigee/Usergrid/Collection.php
@@ -274,5 +274,21 @@ class Collection {
     }
     return FALSE;
   }
+  public function serialize(){
+    $data = array();
+    $data->type = $this->type;
+    $data->qs = $this->qs;
+    $data->iterator = $this->iterator;
+    $data->previous = $this->previous;
+    $data->next = $this->next;
+    $data->cursor = $this->cursor;
+    $data->list=[];
+    $this->reset_entity_pointer();
+    while ($this->has_next_entity()) {
+        $entity = $this->get_next_entity();
+        array_push($data->list, $entity->get_json())
+    }
+    return json_encode($data);
+  }
 
-}
\ No newline at end of file
+}