Skip to content

Commit d4cb69d

Browse files
committed
fixed examples
Conflicts: README.md
1 parent 4d2c926 commit d4cb69d

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ In order to use ArangoDB, you need to specify the connection options. We do so b
206206
require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ArangoDB-PHP' . DIRECTORY_SEPARATOR . 'autoload.php';
207207

208208
// set up some aliases for less typing later
209+
use triagens\ArangoDb\Collection as ArangoCollection;
210+
use triagens\ArangoDb\CollectionHandler as ArangoCollectionHandler;
209211
use triagens\ArangoDb\Connection as ArangoConnection;
210212
use triagens\ArangoDb\ConnectionOptions as ArangoConnectionOptions;
211213
use triagens\ArangoDb\DocumentHandler as ArangoDocumentHandler;
@@ -269,10 +271,10 @@ So, after we get the settings, we can start with creating a collection. We will
269271
The below code will first set up the collection locally in a variable name $user, and then push it to the server and return the collection id created by the server:
270272

271273
```php
272-
$collectionHandler = new triagens\ArangoDb\CollectionHandler($connection);
274+
$collectionHandler = new ArangoCollectionHandler($connection);
273275

274276
// create a new document
275-
$userCollection = new triagens\ArangoDb\Collection();
277+
$userCollection = new ArangoCollection();
276278
$userCollection->setName('users');
277279
$id = $collectionHandler->add($userCollection);
278280

@@ -470,11 +472,14 @@ Here's the full code that combines all the pieces outlined above:
470472

471473
```php
472474
// use the following line when using packagist/composer
473-
//require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . '.composer' . DIRECTORY_SEPARATOR . 'autoload.php';
475+
// require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . '.composer' . DIRECTORY_SEPARATOR . 'autoload.php';
476+
474477
// use the following line when using git
475478
require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ArangoDB-PHP' . DIRECTORY_SEPARATOR . 'autoload.php';
476479

477480
// set up some aliases for less typing later
481+
use triagens\ArangoDb\Collection as ArangoCollection;
482+
use triagens\ArangoDb\CollectionHandler as ArangoCollectionHandler;
478483
use triagens\ArangoDb\Connection as ArangoConnection;
479484
use triagens\ArangoDb\ConnectionOptions as ArangoConnectionOptions;
480485
use triagens\ArangoDb\DocumentHandler as ArangoDocumentHandler;
@@ -487,6 +492,7 @@ use triagens\ArangoDb\UpdatePolicy as ArangoUpdatePolicy;
487492

488493
// set up some basic connection options
489494
$connectionOptions = array(
495+
// server endpoint to connect to
490496
ArangoConnectionOptions::OPTION_ENDPOINT => 'tcp://127.0.0.1:8529',
491497
// authorization type to use (currently supported: 'Basic')
492498
ArangoConnectionOptions::OPTION_AUTH_TYPE => 'Basic',
@@ -508,17 +514,16 @@ try {
508514
$connection = new ArangoConnection($connectionOptions);
509515

510516

511-
$collectionHandler = new CollectionHandler($connection);
517+
$collectionHandler = new ArangoCollectionHandler($connection);
512518

513519
// create a new document
514520
$userCollection = new ArangoCollection();
515-
$userCollection->setName('user');
516-
$id = $collectionHandler->add($userCollection);
521+
$userCollection->setName('users');
522+
$id = $collectionHandler->add($userCollection);
517523

518524
// print the collection id created by the server
519525
var_dump($id);
520526

521-
522527
$handler = new ArangoDocumentHandler($connection);
523528

524529
// create a new document

0 commit comments

Comments
 (0)