Skip to content

Commit 4781fd8

Browse files
committed
Added 'all' Method which corresponds to /simple/all
Added 'Method' to get all Documents from a Collection. This Method corresponds to the /simple/all Method see: https://www.arangodb.org/manuals/current/HttpSimple.html#HttpSimpleAll
1 parent 524c805 commit 4781fd8

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

lib/triagens/ArangoDb/CollectionHandler.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,52 @@ public function range($collectionId, $attribute, $left, $right, $options = array
12111211
return new Cursor($this->getConnection(), $response->getJson(), $options);
12121212
}
12131213

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+
12141260

12151261
/**
12161262
* Get document(s) by specifying near

0 commit comments

Comments
 (0)