/** * Test export with invalid restriction definition * * @expectedException \triagens\ArangoDb\ClientException */ public function testExportRestrictMissingFields() { if (!$this->hasExportApi) { throw new ClientException('Invalid restrictions fields definition'); } $export = new Export($this->connection, $this->collection, array("restrict" => array("type" => "include"))); $cursor = $export->execute(); }
<?php namespace triagens\ArangoDb; require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'init.php'; try { $connection = new Connection($connectionOptions); // creates an export object for collection 'users' $export = new Export($connection, 'users', array("batchSize" => 5000, "_flat" => true, "flush" => true, "restrict" => array("type" => "include", "fields" => array("_key", "_rev")))); // execute the export. this will return a special, forward-only cursor $cursor = $export->execute(); // now we can fetch the documents from the collection in blocks while ($docs = $cursor->getNextBatch()) { // do something with $docs print sprintf("retrieved %d documents", count($docs)) . PHP_EOL; } } catch (ConnectException $e) { print $e . PHP_EOL; } catch (ServerException $e) { print $e . PHP_EOL; } catch (ClientException $e) { print $e . PHP_EOL; }