Skip to content

Commit ed4eeb9

Browse files
committed
renamed namespace triagens\ArangoDb to ArangoDBClient
1 parent 18e77b6 commit ed4eeb9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+545
-453
lines changed

CHANGELOG

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
Release notes for the ArangoDB-PHP driver 3.2.0 (currently in development)
2+
==========================================================================
3+
4+
The namespace `\triagens\ArangoDb` was replaced with `\ArangoDBClient`.
5+
For each class in the old namespace there is now a class alias that points
6+
from the new namespace to the old namespace, so existing applications can
7+
still use the class names from the `\triagens\ArangoDb` namespace
8+
19
Release notes for the ArangoDB-PHP driver 3.1.0
210
===============================================
311

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Documentation is generated with the apigen generator with the following paramete
4242

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

4848

README.md

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ The ArangoDB PHP client's autoloader will only care about its own class files an
183183
If you do not wish to include autoload.php to load and setup the autoloader, you can invoke the autoloader directly:
184184

185185
```php
186-
require 'arangodb-php/lib/triagens/ArangoDb/autoloader.php';
187-
\triagens\ArangoDb\Autoloader::init();
186+
require 'arangodb-php/lib/ArangoDBClient/autoloader.php';
187+
\ArangoDBClient\Autoloader::init();
188188
```
189189

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

207207
// set up some aliases for less typing later
208-
use triagens\ArangoDb\Collection as ArangoCollection;
209-
use triagens\ArangoDb\CollectionHandler as ArangoCollectionHandler;
210-
use triagens\ArangoDb\Connection as ArangoConnection;
211-
use triagens\ArangoDb\ConnectionOptions as ArangoConnectionOptions;
212-
use triagens\ArangoDb\DocumentHandler as ArangoDocumentHandler;
213-
use triagens\ArangoDb\Document as ArangoDocument;
214-
use triagens\ArangoDb\Exception as ArangoException;
215-
use triagens\ArangoDb\Export as ArangoExport;
216-
use triagens\ArangoDb\ConnectException as ArangoConnectException;
217-
use triagens\ArangoDb\ClientException as ArangoClientException;
218-
use triagens\ArangoDb\ServerException as ArangoServerException;
219-
use triagens\ArangoDb\Statement as ArangoStatement;
220-
use triagens\ArangoDb\UpdatePolicy as ArangoUpdatePolicy;
208+
use ArangoDBClient\Collection as ArangoCollection;
209+
use ArangoDBClient\CollectionHandler as ArangoCollectionHandler;
210+
use ArangoDBClient\Connection as ArangoConnection;
211+
use ArangoDBClient\ConnectionOptions as ArangoConnectionOptions;
212+
use ArangoDBClient\DocumentHandler as ArangoDocumentHandler;
213+
use ArangoDBClient\Document as ArangoDocument;
214+
use ArangoDBClient\Exception as ArangoException;
215+
use ArangoDBClient\Export as ArangoExport;
216+
use ArangoDBClient\ConnectException as ArangoConnectException;
217+
use ArangoDBClient\ClientException as ArangoClientException;
218+
use ArangoDBClient\ServerException as ArangoServerException;
219+
use ArangoDBClient\Statement as ArangoStatement;
220+
use ArangoDBClient\UpdatePolicy as ArangoUpdatePolicy;
221221

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

395-
object(triagens\ArangoDb\Document)##6 (4) {
396-
["_id":"triagens\ArangoDb\Document":private]=>
395+
object(ArangoDBClient\Document)##6 (4) {
396+
["_id":"ArangoDBClient\Document":private]=>
397397
string(15) "2377907/4818344"
398-
["_rev":"triagens\ArangoDb\Document":private]=>
398+
["_rev":"ArangoDBClient\Document":private]=>
399399
int(4818344)
400-
["_values":"triagens\ArangoDb\Document":private]=>
400+
["_values":"ArangoDBClient\Document":private]=>
401401
array(3) {
402402
["age"]=>
403403
int(25)
@@ -413,7 +413,7 @@ object(triagens\ArangoDb\Document)##6 (4) {
413413
string(8) "swimming"
414414
}
415415
}
416-
["_changed":"triagens\ArangoDb\Document":private]=>
416+
["_changed":"ArangoDBClient\Document":private]=>
417417
bool(false)
418418
}
419419
*/
@@ -528,7 +528,7 @@ Note that the document must have been fetched from the server before. If you hav
528528

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

690690
```php
691-
use triagens\ArangoDb\Exception as ArangoException;
691+
use ArangoDBClient\Exception as ArangoException;
692692

693693
ArangoException::enableLogging();
694694
```
695695

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

698698
```php
699-
use triagens\ArangoDb\Exception as ArangoException;
699+
use ArangoDBClient\Exception as ArangoException;
700700

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

716716
// set up some aliases for less typing later
717-
use triagens\ArangoDb\Collection as ArangoCollection;
718-
use triagens\ArangoDb\CollectionHandler as ArangoCollectionHandler;
719-
use triagens\ArangoDb\Connection as ArangoConnection;
720-
use triagens\ArangoDb\ConnectionOptions as ArangoConnectionOptions;
721-
use triagens\ArangoDb\DocumentHandler as ArangoDocumentHandler;
722-
use triagens\ArangoDb\Document as ArangoDocument;
723-
use triagens\ArangoDb\Exception as ArangoException;
724-
use triagens\ArangoDb\Export as ArangoExport;
725-
use triagens\ArangoDb\ConnectException as ArangoConnectException;
726-
use triagens\ArangoDb\ClientException as ArangoClientException;
727-
use triagens\ArangoDb\ServerException as ArangoServerException;
728-
use triagens\ArangoDb\Statement as ArangoStatement;
729-
use triagens\ArangoDb\UpdatePolicy as ArangoUpdatePolicy;
717+
use ArangoDBClient\Collection as ArangoCollection;
718+
use ArangoDBClient\CollectionHandler as ArangoCollectionHandler;
719+
use ArangoDBClient\Connection as ArangoConnection;
720+
use ArangoDBClient\ConnectionOptions as ArangoConnectionOptions;
721+
use ArangoDBClient\DocumentHandler as ArangoDocumentHandler;
722+
use ArangoDBClient\Document as ArangoDocument;
723+
use ArangoDBClient\Exception as ArangoException;
724+
use ArangoDBClient\Export as ArangoExport;
725+
use ArangoDBClient\ConnectException as ArangoConnectException;
726+
use ArangoDBClient\ClientException as ArangoClientException;
727+
use ArangoDBClient\ServerException as ArangoServerException;
728+
use ArangoDBClient\Statement as ArangoStatement;
729+
use ArangoDBClient\UpdatePolicy as ArangoUpdatePolicy;
730730

731731
// set up some basic connection options
732732
$connectionOptions = [
@@ -879,7 +879,7 @@ try {
879879

880880
try {
881881
$result = $handler->removeById('users', $userFromServer->getId());
882-
} catch (\triagens\ArangoDb\ServerException $e) {
882+
} catch (\ArangoDBClient\ServerException $e) {
883883
$e->getMessage();
884884
}
885885

autoload.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

3-
namespace triagens\ArangoDb;
3+
namespace ArangoDBClient;
44

5-
require __DIR__ . '/lib/triagens/ArangoDb/Autoloader.php';
5+
require __DIR__ . '/lib/ArangoDBClient/Autoloader.php';
66

77
Autoloader::init();

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"autoload": {
2828
"psr-0": {
29-
"triagens\\ArangoDb": "lib/"
29+
"ArangoDBClient": "lib/"
3030
}
3131
},
3232
"repositories": [

examples/bulk.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace triagens\ArangoDb;
3+
namespace ArangoDBClient;
44

55
require __DIR__ . '/init.php';
66

@@ -9,12 +9,12 @@
99
$handler = new CollectionHandler($connection);
1010

1111
if ($handler->has('example')) {
12-
$handler->delete('example');
12+
$handler->drop('example');
1313
}
1414

1515
$col = new Collection();
1616
$col->setName('example');
17-
$handler->add($col);
17+
$handler->create($col);
1818

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

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

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

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

4747
} catch (ConnectException $e) {
4848
print $e . PHP_EOL;

examples/collection.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace triagens\ArangoDb;
3+
namespace ArangoDBClient;
44

55
require __DIR__ . '/init.php';
66

@@ -11,7 +11,7 @@
1111
// create a new collection
1212
$col = new Collection();
1313
$col->setName('hihi');
14-
$result = $handler->add($col);
14+
$result = $handler->create($col);
1515
var_dump($result);
1616

1717
// check if a collection exists
@@ -27,15 +27,15 @@
2727
var_dump($result);
2828

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

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

3737
// delete the collection
38-
$result = $handler->delete('hihi');
38+
$result = $handler->drop('hihi');
3939
var_dump($result);
4040
// rename a collection
4141
// $handler->rename($col, "hihi30");

examples/document.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<?php
22

3-
namespace triagens\ArangoDb;
3+
namespace ArangoDBClient;
44

55
require __DIR__ . '/init.php';
66

7-
87
try {
98
$connection = new Connection($connectionOptions);
109
$collectionHandler = new CollectionHandler($connection);
@@ -13,7 +12,7 @@
1312
// set up a document collection "users"
1413
$collection = new Collection('users');
1514
try {
16-
$collectionHandler->add($collection);
15+
$collectionHandler->create($collection);
1716
}
1817
catch (\Exception $e) {
1918
// collection may already exist - ignore this error for now
@@ -31,7 +30,7 @@
3130
var_dump($cursor->getAll());
3231

3332
// get the ids of all documents in the collection
34-
$result = $handler->getAllIds('users');
33+
$result = $collectionHandler->getAllIds('users');
3534
var_dump($result);
3635

3736
// create another new document
@@ -58,7 +57,7 @@
5857
var_dump($result);
5958

6059
// delete the document
61-
$result = $handler->deleteById('users', $id);
60+
$result = $handler->removeById('users', $id);
6261
var_dump($result);
6362

6463
// check if a document exists

examples/edge.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<?php
22

3-
namespace triagens\ArangoDb;
3+
namespace ArangoDBClient;
44

55
require __DIR__ . '/init.php';
66

7-
87
try {
98
$connection = new Connection($connectionOptions);
109
$collectionHandler = new CollectionHandler($connection);
@@ -14,15 +13,15 @@
1413
// set up two document collections
1514
$collection = new Collection('employees');
1615
try {
17-
$collectionHandler->add($collection);
16+
$collectionHandler->create($collection);
1817
}
1918
catch (\Exception $e) {
2019
// collection may already exist - ignore this error for now
2120
}
2221

2322
$collection = new Collection('departments');
2423
try {
25-
$collectionHandler->add($collection);
24+
$collectionHandler->create($collection);
2625
}
2726
catch (\Exception $e) {
2827
// collection may already exist - ignore this error for now
@@ -33,7 +32,7 @@
3332
$collection->setType(3);
3433

3534
try {
36-
$collectionHandler->add($collection);
35+
$collectionHandler->create($collection);
3736
}
3837
catch (\Exception $e) {
3938
// collection may already exist - ignore this error for now

examples/export.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace triagens\ArangoDb;
3+
namespace ArangoDBClient;
44

55
require __DIR__ . '/init.php';
66

0 commit comments

Comments
 (0)