@@ -215,7 +215,7 @@ class CollectionHandler extends
215
215
*/
216
216
public function get ($ collectionId )
217
217
{
218
- $ url = UrlHelper::buildUrl (Urls::URL_COLLECTION , $ collectionId );
218
+ $ url = UrlHelper::buildUrl (Urls::URL_COLLECTION , array ( $ collectionId) );
219
219
$ response = $ this ->getConnection ()->get ($ url );
220
220
221
221
$ data = $ response ->getJson ();
@@ -237,7 +237,7 @@ public function get($collectionId)
237
237
*/
238
238
public function getProperties ($ collectionId )
239
239
{
240
- $ url = UrlHelper::buildUrl (Urls::URL_COLLECTION , $ collectionId , self ::OPTION_PROPERTIES );
240
+ $ url = UrlHelper::buildUrl (Urls::URL_COLLECTION , array ( $ collectionId , self ::OPTION_PROPERTIES ) );
241
241
$ response = $ this ->getConnection ()->get ($ url );
242
242
243
243
$ data = $ response ->getJson ();
@@ -278,7 +278,7 @@ public function getCount($collectionId)
278
278
*/
279
279
public function count ($ collectionId )
280
280
{
281
- $ url = UrlHelper::buildUrl (Urls::URL_COLLECTION , $ collectionId , self ::OPTION_COUNT );
281
+ $ url = UrlHelper::buildUrl (Urls::URL_COLLECTION , array ( $ collectionId , self ::OPTION_COUNT ) );
282
282
$ response = $ this ->getConnection ()->get ($ url );
283
283
284
284
$ data = $ response ->getJson ();
@@ -320,7 +320,7 @@ public function getFigures($collectionId)
320
320
*/
321
321
public function figures ($ collectionId )
322
322
{
323
- $ url = UrlHelper::buildUrl (Urls::URL_COLLECTION , $ collectionId , self ::OPTION_FIGURES );
323
+ $ url = UrlHelper::buildUrl (Urls::URL_COLLECTION , array ( $ collectionId , self ::OPTION_FIGURES ) );
324
324
$ response = $ this ->getConnection ()->get ($ url );
325
325
326
326
$ data = $ response ->getJson ();
@@ -605,7 +605,7 @@ public function index($collectionId, $type = "", $attributes = array(), $unique
605
605
*/
606
606
public function getIndex ($ collection , $ indexId )
607
607
{
608
- $ url = UrlHelper::buildUrl (Urls::URL_INDEX , $ collection , $ indexId );
608
+ $ url = UrlHelper::buildUrl (Urls::URL_INDEX , array ( $ collection , $ indexId) );
609
609
$ response = $ this ->getConnection ()->get ($ url );
610
610
611
611
$ data = $ response ->getJson ();
@@ -648,7 +648,7 @@ public function getIndexes($collectionId)
648
648
public function dropIndex ($ indexHandle )
649
649
{
650
650
$ handle = explode ("/ " , $ indexHandle );
651
- $ this ->getConnection ()->delete (UrlHelper::buildUrl (Urls::URL_INDEX , $ handle [0 ], $ handle [1 ]));
651
+ $ this ->getConnection ()->delete (UrlHelper::buildUrl (Urls::URL_INDEX , array ( $ handle [0 ], $ handle [1 ]) ));
652
652
653
653
return true ;
654
654
}
@@ -688,7 +688,7 @@ public function drop($collection)
688
688
throw new ClientException ('Cannot alter a collection without a collection id ' );
689
689
}
690
690
691
- $ this ->getConnection ()->delete (UrlHelper::buildUrl (Urls::URL_COLLECTION , $ collectionName ));
691
+ $ this ->getConnection ()->delete (UrlHelper::buildUrl (Urls::URL_COLLECTION , array ( $ collectionName) ));
692
692
693
693
return true ;
694
694
}
@@ -713,7 +713,7 @@ public function rename($collection, $name)
713
713
714
714
$ params = array (Collection::ENTRY_NAME => $ name );
715
715
$ this ->getConnection ()->put (
716
- UrlHelper::buildUrl (Urls::URL_COLLECTION , $ collectionId , self ::OPTION_RENAME ),
716
+ UrlHelper::buildUrl (Urls::URL_COLLECTION , array ( $ collectionId , self ::OPTION_RENAME ) ),
717
717
$ this ->json_encode_wrapper ($ params )
718
718
);
719
719
@@ -740,7 +740,7 @@ public function load($collection)
740
740
}
741
741
742
742
$ result = $ this ->getConnection ()->put (
743
- UrlHelper::buildUrl (Urls::URL_COLLECTION , $ collectionId , self ::OPTION_LOAD ),
743
+ UrlHelper::buildUrl (Urls::URL_COLLECTION , array ( $ collectionId , self ::OPTION_LOAD ) ),
744
744
''
745
745
);
746
746
@@ -768,7 +768,7 @@ public function unload($collection)
768
768
}
769
769
770
770
$ result = $ this ->getConnection ()->put (
771
- UrlHelper::buildUrl (Urls::URL_COLLECTION , $ collectionId , self ::OPTION_UNLOAD ),
771
+ UrlHelper::buildUrl (Urls::URL_COLLECTION , array ( $ collectionId , self ::OPTION_UNLOAD ) ),
772
772
''
773
773
);
774
774
@@ -796,7 +796,7 @@ public function truncate($collection)
796
796
}
797
797
798
798
$ this ->getConnection ()->put (
799
- UrlHelper::buildUrl (Urls::URL_COLLECTION , $ collectionId , self ::OPTION_TRUNCATE ),
799
+ UrlHelper::buildUrl (Urls::URL_COLLECTION , array ( $ collectionId , self ::OPTION_TRUNCATE ) ),
800
800
''
801
801
);
802
802
@@ -1012,7 +1012,7 @@ public function updateByExample($collectionId, $example, $newValue, $options = a
1012
1012
)
1013
1013
);
1014
1014
1015
- #$url = UrlHelper::buildUrl(Urls::URL_DOCUMENT, $collectionId);
1015
+ #$url = UrlHelper::buildUrl(Urls::URL_DOCUMENT, array( $collectionId) );
1016
1016
#$result = $this->getConnection()->patch($url, $this->json_encode_wrapper($body));
1017
1017
1018
1018
$ response = $ this ->getConnection ()->put (Urls::URL_UPDATE_BY_EXAMPLE , $ this ->json_encode_wrapper ($ body ));
@@ -1075,7 +1075,7 @@ public function replaceByExample($collectionId, $example, $newValue, $options =
1075
1075
)
1076
1076
);
1077
1077
1078
- #$url = UrlHelper::buildUrl(Urls::URL_DOCUMENT, $collectionId);
1078
+ #$url = UrlHelper::buildUrl(Urls::URL_DOCUMENT, array( $collectionId) );
1079
1079
#$result = $this->getConnection()->patch($url, $this->json_encode_wrapper($body));
1080
1080
1081
1081
$ response = $ this ->getConnection ()->put (Urls::URL_REPLACE_BY_EXAMPLE , $ this ->json_encode_wrapper ($ body ));
@@ -1211,6 +1211,52 @@ public function range($collectionId, $attribute, $left, $right, $options = array
1211
1211
return new Cursor ($ this ->getConnection (), $ response ->getJson (), $ options );
1212
1212
}
1213
1213
1214
+ /**
1215
+ * Returns all documents of a collection
1216
+ *
1217
+ * @param mixed $collectionId - collection id as string or number
1218
+ * @param array $options - optional array of options.
1219
+ * <p>Options are :<br>
1220
+ * <li>'_sanitize' - True to remove _id and _rev attributes from result documents. Defaults to false.</li>
1221
+ * <li>'sanitize' - Deprecated, please use '_sanitize'.</li>
1222
+ * <li>'_hiddenAttributes' - Set an array of hidden attributes for created documents.
1223
+ * <li>'hiddenAttributes' - Deprecated, please use '_hiddenAttributes'.</li>
1224
+ * <p>
1225
+ * This is actually the same as setting hidden attributes using setHiddenAttributes() on a document.<br>
1226
+ * The difference is, that if you're returning a resultset of documents, the getAll() is already called<br>
1227
+ * and the hidden attributes would not be applied to the attributes.<br>
1228
+ * </p>
1229
+ *
1230
+ * <li>'batchSize' - can optionally be used to tell the server to limit the number of results to be transferred in one batch</li>
1231
+ * <li>'skip' - Optional, The number of documents to skip in the query.</li>
1232
+ * <li>'limit' - Optional, The maximal amount of documents to return. 'skip' is applied before the limit restriction.</li>
1233
+ * </li>
1234
+ * </p>
1235
+ *
1236
+ * @return Cursor - documents
1237
+ */
1238
+ public function all ($ collectionId , $ options = array ())
1239
+ {
1240
+ $ options = array_merge ($ options , $ this ->getCursorOptions ($ options ));
1241
+
1242
+ $ body = array (
1243
+ self ::OPTION_COLLECTION => $ collectionId ,
1244
+ );
1245
+
1246
+ $ body = $ this ->includeOptionsInBody (
1247
+ $ options ,
1248
+ $ body ,
1249
+ array (
1250
+ self ::OPTION_LIMIT => null ,
1251
+ self ::OPTION_SKIP => null ,
1252
+ )
1253
+ );
1254
+
1255
+ $ response = $ this ->getConnection ()->put (Urls::URL_ALL , $ this ->json_encode_wrapper ($ body ));
1256
+
1257
+ return new Cursor ($ this ->getConnection (), $ response ->getJson (), $ options );
1258
+ }
1259
+
1214
1260
1215
1261
/**
1216
1262
* Get document(s) by specifying near
@@ -1393,7 +1439,7 @@ public function getAllCollections($options = array())
1393
1439
$ params [self ::OPTION_EXCLUDE_SYSTEM ] = true ;
1394
1440
}
1395
1441
$ url = UrlHelper::appendParamsUrl (Urls::URL_COLLECTION , $ params );
1396
- $ response = $ this ->getConnection ()->get (UrlHelper::buildUrl ($ url ));
1442
+ $ response = $ this ->getConnection ()->get (UrlHelper::buildUrl ($ url, array () ));
1397
1443
$ response = $ response ->getJson ();
1398
1444
if (isset ($ options ["keys " ]) && isset ($ response [$ options ["keys " ]])) {
1399
1445
return $ response [$ options ["keys " ]];
0 commit comments