Skip to content

Commit

Permalink
renamed namespace triagens\ArangoDb to ArangoDBClient
Browse files Browse the repository at this point in the history
  • Loading branch information
jsteemann committed Nov 15, 2016
1 parent 18e77b6 commit ed4eeb9
Show file tree
Hide file tree
Showing 81 changed files with 545 additions and 453 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Release notes for the ArangoDB-PHP driver 3.2.0 (currently in development)
==========================================================================

The namespace `\triagens\ArangoDb` was replaced with `\ArangoDBClient`.
For each class in the old namespace there is now a class alias that points
from the new namespace to the old namespace, so existing applications can
still use the class names from the `\triagens\ArangoDb` namespace

Release notes for the ArangoDB-PHP driver 3.1.0
===============================================

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Documentation is generated with the apigen generator with the following paramete

Example:
```
php -f apigen.phar generate -s ./lib/triagens/ArangoDb -d ./docs --template-theme bootstrap --title "ArangoDB-PHP API Documentation" --deprecated
php -f apigen.phar generate -s ./lib/ArangoDBClient -d ./docs --template-theme bootstrap --title "ArangoDB-PHP API Documentation" --deprecated
```


Expand Down
74 changes: 37 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ The ArangoDB PHP client's autoloader will only care about its own class files an
If you do not wish to include autoload.php to load and setup the autoloader, you can invoke the autoloader directly:

```php
require 'arangodb-php/lib/triagens/ArangoDb/autoloader.php';
\triagens\ArangoDb\Autoloader::init();
require 'arangodb-php/lib/ArangoDBClient/autoloader.php';
\ArangoDBClient\Autoloader::init();
```

<br>
Expand All @@ -205,19 +205,19 @@ In order to use ArangoDB, you need to specify the connection options. We do so b
require __DIR__ . '/arangodb-php/autoload.php';

// set up some aliases for less typing later
use triagens\ArangoDb\Collection as ArangoCollection;
use triagens\ArangoDb\CollectionHandler as ArangoCollectionHandler;
use triagens\ArangoDb\Connection as ArangoConnection;
use triagens\ArangoDb\ConnectionOptions as ArangoConnectionOptions;
use triagens\ArangoDb\DocumentHandler as ArangoDocumentHandler;
use triagens\ArangoDb\Document as ArangoDocument;
use triagens\ArangoDb\Exception as ArangoException;
use triagens\ArangoDb\Export as ArangoExport;
use triagens\ArangoDb\ConnectException as ArangoConnectException;
use triagens\ArangoDb\ClientException as ArangoClientException;
use triagens\ArangoDb\ServerException as ArangoServerException;
use triagens\ArangoDb\Statement as ArangoStatement;
use triagens\ArangoDb\UpdatePolicy as ArangoUpdatePolicy;
use ArangoDBClient\Collection as ArangoCollection;
use ArangoDBClient\CollectionHandler as ArangoCollectionHandler;
use ArangoDBClient\Connection as ArangoConnection;
use ArangoDBClient\ConnectionOptions as ArangoConnectionOptions;
use ArangoDBClient\DocumentHandler as ArangoDocumentHandler;
use ArangoDBClient\Document as ArangoDocument;
use ArangoDBClient\Exception as ArangoException;
use ArangoDBClient\Export as ArangoExport;
use ArangoDBClient\ConnectException as ArangoConnectException;
use ArangoDBClient\ClientException as ArangoClientException;
use ArangoDBClient\ServerException as ArangoServerException;
use ArangoDBClient\Statement as ArangoStatement;
use ArangoDBClient\UpdatePolicy as ArangoUpdatePolicy;

// set up some basic connection options
$connectionOptions = [
Expand Down Expand Up @@ -392,12 +392,12 @@ To retrieve a document from the server, the get() method of the *DocumentHandler
/*
The result of the get() method is a Document object that you can use in an OO fashion:

object(triagens\ArangoDb\Document)##6 (4) {
["_id":"triagens\ArangoDb\Document":private]=>
object(ArangoDBClient\Document)##6 (4) {
["_id":"ArangoDBClient\Document":private]=>
string(15) "2377907/4818344"
["_rev":"triagens\ArangoDb\Document":private]=>
["_rev":"ArangoDBClient\Document":private]=>
int(4818344)
["_values":"triagens\ArangoDb\Document":private]=>
["_values":"ArangoDBClient\Document":private]=>
array(3) {
["age"]=>
int(25)
Expand All @@ -413,7 +413,7 @@ object(triagens\ArangoDb\Document)##6 (4) {
string(8) "swimming"
}
}
["_changed":"triagens\ArangoDb\Document":private]=>
["_changed":"ArangoDBClient\Document":private]=>
bool(false)
}
*/
Expand Down Expand Up @@ -528,7 +528,7 @@ Note that the document must have been fetched from the server before. If you hav

try {
$result = $handler->removeById('users', $userFromServer->getId());
} catch (\triagens\ArangoDb\ServerException $e) {
} catch (\ArangoDBClient\ServerException $e) {
$e->getMessage();
}
```
Expand Down Expand Up @@ -688,15 +688,15 @@ To turn on exception logging in the driver, set a flag on the driver's Exception
driver exceptions are subclassed:

```php
use triagens\ArangoDb\Exception as ArangoException;
use ArangoDBClient\Exception as ArangoException;

ArangoException::enableLogging();
```

To turn logging off, call its `disableLogging` method:

```php
use triagens\ArangoDb\Exception as ArangoException;
use ArangoDBClient\Exception as ArangoException;

ArangoException::disableLogging();
```
Expand All @@ -714,19 +714,19 @@ Here's the full code that combines all the pieces outlined above:
require __DIR__ . '/autoload.php';

// set up some aliases for less typing later
use triagens\ArangoDb\Collection as ArangoCollection;
use triagens\ArangoDb\CollectionHandler as ArangoCollectionHandler;
use triagens\ArangoDb\Connection as ArangoConnection;
use triagens\ArangoDb\ConnectionOptions as ArangoConnectionOptions;
use triagens\ArangoDb\DocumentHandler as ArangoDocumentHandler;
use triagens\ArangoDb\Document as ArangoDocument;
use triagens\ArangoDb\Exception as ArangoException;
use triagens\ArangoDb\Export as ArangoExport;
use triagens\ArangoDb\ConnectException as ArangoConnectException;
use triagens\ArangoDb\ClientException as ArangoClientException;
use triagens\ArangoDb\ServerException as ArangoServerException;
use triagens\ArangoDb\Statement as ArangoStatement;
use triagens\ArangoDb\UpdatePolicy as ArangoUpdatePolicy;
use ArangoDBClient\Collection as ArangoCollection;
use ArangoDBClient\CollectionHandler as ArangoCollectionHandler;
use ArangoDBClient\Connection as ArangoConnection;
use ArangoDBClient\ConnectionOptions as ArangoConnectionOptions;
use ArangoDBClient\DocumentHandler as ArangoDocumentHandler;
use ArangoDBClient\Document as ArangoDocument;
use ArangoDBClient\Exception as ArangoException;
use ArangoDBClient\Export as ArangoExport;
use ArangoDBClient\ConnectException as ArangoConnectException;
use ArangoDBClient\ClientException as ArangoClientException;
use ArangoDBClient\ServerException as ArangoServerException;
use ArangoDBClient\Statement as ArangoStatement;
use ArangoDBClient\UpdatePolicy as ArangoUpdatePolicy;

// set up some basic connection options
$connectionOptions = [
Expand Down Expand Up @@ -879,7 +879,7 @@ try {

try {
$result = $handler->removeById('users', $userFromServer->getId());
} catch (\triagens\ArangoDb\ServerException $e) {
} catch (\ArangoDBClient\ServerException $e) {
$e->getMessage();
}

Expand Down
4 changes: 2 additions & 2 deletions autoload.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

namespace triagens\ArangoDb;
namespace ArangoDBClient;

require __DIR__ . '/lib/triagens/ArangoDb/Autoloader.php';
require __DIR__ . '/lib/ArangoDBClient/Autoloader.php';

Autoloader::init();
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"autoload": {
"psr-0": {
"triagens\\ArangoDb": "lib/"
"ArangoDBClient": "lib/"
}
},
"repositories": [
Expand Down
12 changes: 6 additions & 6 deletions examples/bulk.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace triagens\ArangoDb;
namespace ArangoDBClient;

require __DIR__ . '/init.php';

Expand All @@ -9,12 +9,12 @@
$handler = new CollectionHandler($connection);

if ($handler->has('example')) {
$handler->delete('example');
$handler->drop('example');
}

$col = new Collection();
$col->setName('example');
$handler->add($col);
$handler->create($col);

// create a statement to insert 100 example documents
$statement = new Statement($connection, [
Expand All @@ -24,10 +24,10 @@
$statement->execute();

// print number of documents
var_dump($handler->getCount('example'));
var_dump($handler->count('example'));

// later on, we can assemble a list of document keys
$keys = '/init.php';
$keys = [];
for ($i = 1; $i <= 100; ++$i) {
$keys[] = 'example' . $i;
}
Expand All @@ -42,7 +42,7 @@
var_dump($result);

// print number of documents after bulk removal
var_dump($handler->getCount('example'));
var_dump($handler->count('example'));

} catch (ConnectException $e) {
print $e . PHP_EOL;
Expand Down
10 changes: 5 additions & 5 deletions examples/collection.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace triagens\ArangoDb;
namespace ArangoDBClient;

require __DIR__ . '/init.php';

Expand All @@ -11,7 +11,7 @@
// create a new collection
$col = new Collection();
$col->setName('hihi');
$result = $handler->add($col);
$result = $handler->create($col);
var_dump($result);

// check if a collection exists
Expand All @@ -27,15 +27,15 @@
var_dump($result);

// get number of documents from an existing collection
$result = $handler->getCount('hihi');
$result = $handler->count('hihi');
var_dump($result);

// get figures for an existing collection
$result = $handler->getFigures('hihi');
$result = $handler->figures('hihi');
var_dump($result);

// delete the collection
$result = $handler->delete('hihi');
$result = $handler->drop('hihi');
var_dump($result);
// rename a collection
// $handler->rename($col, "hihi30");
Expand Down
9 changes: 4 additions & 5 deletions examples/document.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php

namespace triagens\ArangoDb;
namespace ArangoDBClient;

require __DIR__ . '/init.php';


try {
$connection = new Connection($connectionOptions);
$collectionHandler = new CollectionHandler($connection);
Expand All @@ -13,7 +12,7 @@
// set up a document collection "users"
$collection = new Collection('users');
try {
$collectionHandler->add($collection);
$collectionHandler->create($collection);
}
catch (\Exception $e) {
// collection may already exist - ignore this error for now
Expand All @@ -31,7 +30,7 @@
var_dump($cursor->getAll());

// get the ids of all documents in the collection
$result = $handler->getAllIds('users');
$result = $collectionHandler->getAllIds('users');
var_dump($result);

// create another new document
Expand All @@ -58,7 +57,7 @@
var_dump($result);

// delete the document
$result = $handler->deleteById('users', $id);
$result = $handler->removeById('users', $id);
var_dump($result);

// check if a document exists
Expand Down
9 changes: 4 additions & 5 deletions examples/edge.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php

namespace triagens\ArangoDb;
namespace ArangoDBClient;

require __DIR__ . '/init.php';


try {
$connection = new Connection($connectionOptions);
$collectionHandler = new CollectionHandler($connection);
Expand All @@ -14,15 +13,15 @@
// set up two document collections
$collection = new Collection('employees');
try {
$collectionHandler->add($collection);
$collectionHandler->create($collection);
}
catch (\Exception $e) {
// collection may already exist - ignore this error for now
}

$collection = new Collection('departments');
try {
$collectionHandler->add($collection);
$collectionHandler->create($collection);
}
catch (\Exception $e) {
// collection may already exist - ignore this error for now
Expand All @@ -33,7 +32,7 @@
$collection->setType(3);

try {
$collectionHandler->add($collection);
$collectionHandler->create($collection);
}
catch (\Exception $e) {
// collection may already exist - ignore this error for now
Expand Down
2 changes: 1 addition & 1 deletion examples/export.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace triagens\ArangoDb;
namespace ArangoDBClient;

require __DIR__ . '/init.php';

Expand Down
10 changes: 5 additions & 5 deletions examples/graph.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace triagens\ArangoDb;

namespace ArangoDBClient;

// get connection options from a helper file
require __DIR__ . '/init.php';
Expand All @@ -11,8 +12,7 @@
$graphHandler = new GraphHandler($connection);
$graph = new Graph();
$graph->set('_key', 'Graph');
$graph->setVerticesCollection('VertexCollection');
$graph->setEdgesCollection('EdgeCollection');
$graph->addEdgeDefinition(EdgeDefinition::createUndirectedRelation('EdgeCollection', 'VertexCollection'));

try {
$graphHandler->dropGraph($graph);
Expand Down Expand Up @@ -45,7 +45,7 @@
// Save the vertices
$graphHandler->saveVertex('Graph', $vertex1);
$graphHandler->saveVertex('Graph', $vertex2);

// Get the vertices
$graphHandler->getVertex('Graph', 'vertex1');
$graphHandler->getVertex('Graph', 'vertex2');
Expand All @@ -65,7 +65,7 @@
// Remove vertices and edges
$graphHandler->removeVertex('Graph', 'vertex1');
$graphHandler->removeVertex('Graph', 'vertex2');

// the connecting edge will be deleted automatically
} catch (ConnectException $e) {
print $e . PHP_EOL;
Expand Down
4 changes: 2 additions & 2 deletions examples/http-test.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace triagens\ArangoDb;
namespace ArangoDBClient;

require __DIR__ . '/init.php';

Expand All @@ -25,7 +25,7 @@

// now create the collection
$collection = new Collection('test');
$collectionHandler->add($collection);
$collectionHandler->create($collection);

echo "creating $n documents" . PHP_EOL;
$time = microtime(true);
Expand Down
Loading

0 comments on commit ed4eeb9

Please sign in to comment.