From e3aae128f4bf753ec799455f0dfb19966cee1adf Mon Sep 17 00:00:00 2001 From: Simran Brucherseifer Date: Tue, 22 Oct 2019 17:59:00 +0200 Subject: [PATCH 1/8] Update links --- README.md | 2 +- docs/Drivers/PHP/GettingStarted/README.md | 2 +- lib/ArangoDBClient/AdminHandler.php | 4 ++-- lib/ArangoDBClient/CollectionHandler.php | 2 +- lib/ArangoDBClient/Database.php | 14 +++++++------- lib/ArangoDBClient/Endpoint.php | 2 +- lib/ArangoDBClient/Traversal.php | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 1b86fa36..24449574 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![ArangoDB-Logo](https://docs.arangodb.com/assets/arangodb_logo_2016_inverted.png) +![ArangoDB-Logo](https://www.arangodb.com/docs/assets/arangodb_logo_2016_inverted.png) # ArangoDB-PHP - A PHP client for ArangoDB The official ArangoDB PHP Driver. diff --git a/docs/Drivers/PHP/GettingStarted/README.md b/docs/Drivers/PHP/GettingStarted/README.md index 0a8c9c1d..201f6247 100644 --- a/docs/Drivers/PHP/GettingStarted/README.md +++ b/docs/Drivers/PHP/GettingStarted/README.md @@ -13,7 +13,7 @@ The autoloader will care about loading additionally required classes on the fly. The ArangoDB PHP client is an API that allows you to send and retrieve documents from ArangoDB from out of your PHP application. The client library itself is written in PHP and has no further dependencies but just plain PHP 5.6 (or higher). -The client library provides document and collection classes you can use to work with documents and collections in an OO fashion. When exchanging document data with the server, the library internally will use the [HTTP REST interface of ArangoDB](../../../HTTP/index.html). The library user does not have to care about this fact as all the details of the REST interface are abstracted by the client library. +The client library provides document and collection classes you can use to work with documents and collections in an OO fashion. When exchanging document data with the server, the library internally will use the [HTTP REST interface of ArangoDB](https://www.arangodb.com/docs/stable/http/index.html). The library user does not have to care about this fact as all the details of the REST interface are abstracted by the client library. ## Requirements diff --git a/lib/ArangoDBClient/AdminHandler.php b/lib/ArangoDBClient/AdminHandler.php index 287b8f9a..c80ef3a3 100644 --- a/lib/ArangoDBClient/AdminHandler.php +++ b/lib/ArangoDBClient/AdminHandler.php @@ -180,7 +180,7 @@ public function reloadServerRouting() * and the distribution list in counts. * For more information on the statistics returned, please lookup the statistics interface description at * - * @link https://docs.arangodb.com/HTTP/AdministrationAndMonitoring/index.html + * @link https://www.arangodb.com/docs/stable/http/administration-and-monitoring.html * * This will throw if the statistics cannot be retrieved * @@ -207,7 +207,7 @@ public function getServerStatistics() * and a list of statistics figures in the attribute figures. * For more information on the statistics returned, please lookup the statistics interface description at * - * @link https://docs.arangodb.com/HTTP/AdministrationAndMonitoring/index.html + * @link https://www.arangodb.com/docs/stable/http/administration-and-monitoring.html * * This will throw if the statistics-description cannot be retrieved * diff --git a/lib/ArangoDBClient/CollectionHandler.php b/lib/ArangoDBClient/CollectionHandler.php index 63e2471c..6d948e90 100644 --- a/lib/ArangoDBClient/CollectionHandler.php +++ b/lib/ArangoDBClient/CollectionHandler.php @@ -811,7 +811,7 @@ public function importFromFile($collection, $importFileName, array $options = [] * * Other options as described in API Documentation* * - * @see https://docs.arangodb.com/3.1/HTTP/BulkImports/ + * @see https://www.arangodb.com/docs/stable/http/bulk-imports.html * * @return array * @throws \ArangoDBClient\Exception diff --git a/lib/ArangoDBClient/Database.php b/lib/ArangoDBClient/Database.php index b7584410..69c4e3a5 100644 --- a/lib/ArangoDBClient/Database.php +++ b/lib/ArangoDBClient/Database.php @@ -15,7 +15,7 @@ * * This class provides functions to manage Databases through ArangoDB's Database API
* - * @link https://docs.arangodb.com/HTTP/Database/index.html + * @link https://www.arangodb.com/docs/stable/http/database.html * * @package ArangoDBClient * @since 1.4 @@ -40,7 +40,7 @@ class Database * @param Connection $connection - the connection to be used * @param string $name - the database specification, for example 'myDatabase' * - * @link https://docs.arangodb.com/HTTP/Database/index.html + * @link https://www.arangodb.com/docs/stable/http/database.html * * @return array $responseArray - The response array. * @throws \ArangoDBClient\Exception @@ -72,7 +72,7 @@ public static function create(Connection $connection, $name) * @param Connection $connection - the connection to be used * @param string $name - the database specification, for example 'myDatabase' * - * @link https://docs.arangodb.com/HTTP/Database/index.html + * @link https://www.arangodb.com/docs/stable/http/database.html * * @return array $responseArray - The response array. * @throws \ArangoDBClient\Exception @@ -95,7 +95,7 @@ public static function delete(Connection $connection, $name) * * @param Connection $connection - the connection to be used * - * @link https://docs.arangodb.com/HTTP/Database/index.html + * @link https://www.arangodb.com/docs/stable/http/database.html * * @return array $responseArray - The response array. * @throws \ArangoDBClient\Exception @@ -113,7 +113,7 @@ public static function listDatabases(Connection $connection) * * @param Connection $connection - the connection to be used * - * @link https://docs.arangodb.com/HTTP/Database/index.html + * @link https://www.arangodb.com/docs/stable/http/database.html * * @return array $responseArray - The response array. * @throws \ArangoDBClient\Exception @@ -134,7 +134,7 @@ public static function databases(Connection $connection) * * @param Connection $connection - the connection to be used * - * @link https://docs.arangodb.com/HTTP/Database/index.html + * @link https://www.arangodb.com/docs/stable/http/database.html * * @return array $responseArray - The response array. * @throws \ArangoDBClient\Exception @@ -158,7 +158,7 @@ public static function listUserDatabases(Connection $connection) * * @param Connection $connection - the connection to be used * - * @link https://docs.arangodb.com/HTTP/Database/index.html + * @link https://www.arangodb.com/docs/stable/http/database.html * * @return array $responseArray - The response array. * @throws \ArangoDBClient\Exception diff --git a/lib/ArangoDBClient/Endpoint.php b/lib/ArangoDBClient/Endpoint.php index 5c015539..c8c8ac05 100644 --- a/lib/ArangoDBClient/Endpoint.php +++ b/lib/ArangoDBClient/Endpoint.php @@ -202,7 +202,7 @@ public static function isValid($value) * * @param Connection $connection - the connection to be used * - * @link https://docs.arangodb.com/HTTP/Endpoints/index.html + * @link https://www.arangodb.com/docs/stable/http/endpoints.html * @return array $responseArray - The response array. * @throws \ArangoDBClient\Exception */ diff --git a/lib/ArangoDBClient/Traversal.php b/lib/ArangoDBClient/Traversal.php index 4cc2845a..545af584 100644 --- a/lib/ArangoDBClient/Traversal.php +++ b/lib/ArangoDBClient/Traversal.php @@ -18,7 +18,7 @@ * The object requires the connection object, the startVertex, the edgeCollection and the optional parameters.
*
* - * @link https://docs.arangodb.com/HTTP/Traversal/index.html + * @link https://www.arangodb.com/docs/stable/http/traversal.html * * @package ArangoDBClient * @since 1.4 From 0b5d175098114ef4180bb60f1b6962ef1a384f97 Mon Sep 17 00:00:00 2001 From: Simran Brucherseifer Date: Tue, 22 Oct 2019 17:59:18 +0200 Subject: [PATCH 2/8] Update links in structure.xml --- docs/structure.xml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/structure.xml b/docs/structure.xml index c80a6b91..b7a9b177 100644 --- a/docs/structure.xml +++ b/docs/structure.xml @@ -2810,7 +2810,7 @@ Note: SSL support is added in ArangoDB server 1.1<br> \ArangoDBClient\Connection - + array @@ -5759,7 +5759,7 @@ declaring all attributes first. The object requires the connection object, the startVertex, the edgeCollection and the optional parameters.<br> <br> - + @@ -8303,7 +8303,7 @@ changed since the last revision check. array - + array @@ -9684,7 +9684,7 @@ This is only for options that are to be sent to the ArangoDB server in a json bo A class for managing ArangoDB Databases This class provides functions to manage Databases through ArangoDB's Database API<br> - + @@ -9718,7 +9718,7 @@ This is only for options that are to be sent to the ArangoDB server in a json bo string - + array @@ -9752,7 +9752,7 @@ This is only for options that are to be sent to the ArangoDB server in a json bo string - + array @@ -9783,7 +9783,7 @@ This is only for options that are to be sent to the ArangoDB server in a json bo \ArangoDBClient\Connection - + array @@ -9809,7 +9809,7 @@ This is only for options that are to be sent to the ArangoDB server in a json bo \ArangoDBClient\Connection - + array @@ -9836,7 +9836,7 @@ specifying a different username or password. \ArangoDBClient\Connection - + array @@ -9862,7 +9862,7 @@ specifying a different username or password. \ArangoDBClient\Connection - + array @@ -26424,7 +26424,7 @@ describing the group stored in system and in that sub-object the value for userT attribute of the same name.In case of a distribution, the returned object contains the total count in count and the distribution list in counts. For more information on the statistics returned, please lookup the statistics interface description at - + \ArangoDBClient\Exception @@ -26443,7 +26443,7 @@ For more information on the statistics returned, please lookup the statistics in The returned objects contains a list of statistics groups in the attribute groups and a list of statistics figures in the attribute figures. For more information on the statistics returned, please lookup the statistics interface description at - + \ArangoDBClient\Exception From 3ce6e3cb442b81c69cfd38d0cf1d07e07274bc4d Mon Sep 17 00:00:00 2001 From: Simran Brucherseifer Date: Tue, 22 Oct 2019 17:59:34 +0200 Subject: [PATCH 3/8] Update links in docs/classes/*.html --- docs/classes/ArangoDBClient.AdminHandler.html | 4 ++-- docs/classes/ArangoDBClient.CollectionHandler.html | 2 +- docs/classes/ArangoDBClient.Database.html | 14 +++++++------- docs/classes/ArangoDBClient.Endpoint.html | 2 +- docs/classes/ArangoDBClient.Traversal.html | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/classes/ArangoDBClient.AdminHandler.html b/docs/classes/ArangoDBClient.AdminHandler.html index 9615fe59..e4535a3a 100644 --- a/docs/classes/ArangoDBClient.AdminHandler.html +++ b/docs/classes/ArangoDBClient.AdminHandler.html @@ -252,7 +252,7 @@

Get the server statistics - + @@ -283,7 +283,7 @@

Returns a description of the statistics returned by getServerStatistics().

- + diff --git a/docs/classes/ArangoDBClient.CollectionHandler.html b/docs/classes/ArangoDBClient.CollectionHandler.html index ceb8ce23..85d410e1 100644 --- a/docs/classes/ArangoDBClient.CollectionHandler.html +++ b/docs/classes/ArangoDBClient.CollectionHandler.html @@ -1220,7 +1220,7 @@

Import documents into a collection

This will throw on all errors except insertion errors

linkThis will throw if the statistics cannot be retrievedThis will throw if the statistics cannot be retrieved
see
linkThis will throw if the statistics-description cannot be retrievedThis will throw if the statistics-description cannot be retrieved
see
- +
see

Parameters

diff --git a/docs/classes/ArangoDBClient.Database.html b/docs/classes/ArangoDBClient.Database.html index 4ff338f7..c5ba219d 100644 --- a/docs/classes/ArangoDBClient.Database.html +++ b/docs/classes/ArangoDBClient.Database.html @@ -95,7 +95,7 @@ - + @@ -116,7 +116,7 @@

creates a database

This creates a new database

linkhttps://docs.arangodb.com/HTTP/Database/index.htmlhttps://www.arangodb.com/docs/stable/http/database.html
package
- +
linkhttps://docs.arangodb.com/HTTP/Database/index.htmlhttps://www.arangodb.com/docs/stable/http/database.html

Parameters

@@ -153,7 +153,7 @@

List databases

This will list the databases that exist on the server

- +
linkhttps://docs.arangodb.com/HTTP/Database/index.htmlhttps://www.arangodb.com/docs/stable/http/database.html

Parameters

@@ -185,7 +185,7 @@

Deletes a database

This will delete an existing database.

- +
linkhttps://docs.arangodb.com/HTTP/Database/index.htmlhttps://www.arangodb.com/docs/stable/http/database.html

Parameters

@@ -222,7 +222,7 @@

Retrieves information about the current database

This will get information about the currently used database from the server

- +
linkhttps://docs.arangodb.com/HTTP/Database/index.htmlhttps://www.arangodb.com/docs/stable/http/database.html

Parameters

@@ -254,7 +254,7 @@

List databases

This will list the databases that exist on the server

- +
linkhttps://docs.arangodb.com/HTTP/Database/index.htmlhttps://www.arangodb.com/docs/stable/http/database.html

Parameters

@@ -287,7 +287,7 @@

List user databases

specifying a different username or password.

- +
linkhttps://docs.arangodb.com/HTTP/Database/index.htmlhttps://www.arangodb.com/docs/stable/http/database.html

Parameters

diff --git a/docs/classes/ArangoDBClient.Endpoint.html b/docs/classes/ArangoDBClient.Endpoint.html index bc9c5fe1..6257d741 100644 --- a/docs/classes/ArangoDBClient.Endpoint.html +++ b/docs/classes/ArangoDBClient.Endpoint.html @@ -218,7 +218,7 @@

List endpoints

This will list the endpoints that are configured on the server

- +
linkhttps://docs.arangodb.com/HTTP/Endpoints/index.htmlhttps://www.arangodb.com/docs/stable/http/endpoints.html

Parameters

diff --git a/docs/classes/ArangoDBClient.Traversal.html b/docs/classes/ArangoDBClient.Traversal.html index c025acd3..88ca24de 100644 --- a/docs/classes/ArangoDBClient.Traversal.html +++ b/docs/classes/ArangoDBClient.Traversal.html @@ -121,7 +121,7 @@ - + From 6ef6c1b787301b2ccd5dc045cb8d11ccd26ca51d Mon Sep 17 00:00:00 2001 From: Simran Brucherseifer Date: Tue, 22 Oct 2019 18:16:24 +0200 Subject: [PATCH 4/8] Format / fix arrangement of changelog --- CHANGELOG.md | 194 ++++++++++++++++++++++----------------------------- 1 file changed, 82 insertions(+), 112 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c513fb0a..4b90db37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ -Release notes for the ArangoDB-PHP driver 3.5.x -=============================================== +# Changelog + +## Release notes for the ArangoDB-PHP driver 3.5.x Made `DocumentHandler::save()` an alias for `DocumentHandler::insert()`, to more closely match the function names used in arangosh/arangod. @@ -23,7 +24,7 @@ Other driver operations than the above are currently not supported within stream Streaming transactions are provided by a new class `StreamingTransaction` and a new handler `StreamingTransactionHandler`. - + $document = new DocumentHandler($connection); $transactionHandler = new StreamingTransactionHandler($connection); @@ -36,16 +37,16 @@ Streaming transactions are provided by a new class `StreamingTransaction` and a // starts the transaction $trx = $transactionHandler->create($trx); - + // get a StreamingTransactionCollection object. this is used to execute operations // in a transaction context $trxCollection = $trx->getCollection('testCollection'); - + // pass the StreamingTransactionCollection into the document operations instead of // a regular Collection object - this will make the operations execute in the context // of the currently running transaction $result = $documentHandler->insert($trxCollection, [ '_key' => 'test1', 'value' => 'test1' ]); - + $result = $documentHandler->insert($trxCollection, [ '_key' => 'test2', 'value' => 'test2' ]); // commits the transaction @@ -125,8 +126,8 @@ Removed unused `$_action` member in class `AqlUserFunction`, also removed its `__toString()` method. -Release notes for the ArangoDB-PHP driver 3.4.x -=============================================== +## Release notes for the ArangoDB-PHP driver 3.4.x + Starting with release 3.4.0, the following constants were removed from the `CollectionHandler` class: @@ -150,9 +151,9 @@ public function createGeoIndex($collectionId, array $fields, $geoJson = null) Additionally the 3.4 release of the driver adds support for the following collection properties: -* replicationFactor: number of replicas to keep per shard in a cluster environment +- replicationFactor: number of replicas to keep per shard in a cluster environment (a replication factor of 1 will be used if this is not specified) -* shardingStrategy: sharding strategy to be used for the collection +- shardingStrategy: sharding strategy to be used for the collection The `Collection` class also got the new methods `setReplicationFactor`, `getReplicationFactor`, `setShardingStrategy` and `getShardingStrategy`. @@ -175,8 +176,8 @@ Basic support for arangosearch views was added in 3.4.0, via the `View` and `Vie classes. -Release notes for the ArangoDB-PHP driver 3.3.x -=============================================== +## Release notes for the ArangoDB-PHP driver 3.3.x + Starting from release 3.3.1, the PHP driver has support for automatic failover, for ArangoDB servers that are started in the active failover mode. This setup requires @@ -185,7 +186,7 @@ using ArangoDB 3.3. In order to use automatic failover from the PHP driver, simply change the "endpoint" attribute of the connection options from a simple endpoint string into an array of endpoint strings: - + $connectionOptions = [ ConnectionOptions::OPTION_ENDPOINT => [ 'tcp://localhost:8531', 'tcp://localhost:8532', 'tcp://localhost:8530' ], ... @@ -193,7 +194,7 @@ endpoint strings: $connection = new Connection($connectionOptions); instead of just - + $connectionOptions = [ ConnectionOptions::OPTION_ENDPOINT => 'tcp://localhost:8530', ... @@ -206,7 +207,7 @@ return an array of endpoints. For the single-server case, the returned value wil an array with the specified endpoint. When active failover is used, the result will be an array with the specified endpoints or the endpoints found (added) at runtime. For example, in - + $options = [ ConnectionOptions::OPTION_ENDPOINT => 'tcp://127.0.0.1:8529' ]; $co = new ConnectionOptions($options); print_r($co[ConnectionOptions::OPTION_ENDPOINT]); @@ -222,14 +223,14 @@ numbers. For example, reading the `port` option here will provide just one of the specified ports, so it should be avoided: - + $options = [ ConnectionOptions::OPTION_ENDPOINT => [ 'tcp://127.0.0.1:8529', 'tcp://127.0.0.1:8530' ] ]; $co = new ConnectionOptions($options); print_r($co[ConnectionOptions::OPTION_PORT]); -Release notes for the ArangoDB-PHP driver 3.2.x -=============================================== +## Release notes for the ArangoDB-PHP driver 3.2.x + - the default value for the authentication type of the `Connection` class is now `Basic` @@ -242,7 +243,7 @@ Release notes for the ArangoDB-PHP driver 3.2.x __Important incompatible changes related to this:__ - Document::getId(): Will return the correct id (CollectionName/DocumentID) instead of the key (DocumentID). - UrlHelper::getDocumentIdFromLocation(): Will now return a "real" _id instead of what was essentially the `_key` - + __Other changes related to this:__ - DocumentHandler::getById(): Will work as before, but it will also accept a "real" document ID in addition to the key. If a real document ID is given, the collection data will be extracted from that string. That means that the first parameter `$collection` does not need to have a valid value, in that case. @@ -261,27 +262,22 @@ still use the class names from the `\triagens\ArangoDb` namespace - `UserHandler::revokeCollectionPermissions` -Release notes for the ArangoDB-PHP driver 3.1.0 -=============================================== +## Release notes for the ArangoDB-PHP driver 3.1.0 + This version of the driver is compatible with ArangoDB 3.1.x It is not compatible to earlier versions of ArangoDB (i.e. 2.x). Please use one of the `2.x` branches of the driver for 2.x-compatibility. - - -Caution!!! -========== +**Caution!** - Up until the 3.0.x versions of this driver, there were still deprecated methods and parameter compatibility functions in the code, which unfortunately were not removed according to their deprecation annotations. That deprecated code was now finally removed with this version (3.1.0) of the driver, in order to clean up the codebase. - With this version of the driver, the method signature that used to accept $options either as an array or a non-array type has been removed. The specific compatibility layer was deprecated a long time ago and did not provide any benefits apart from compatibility. Starting with this version of the driver, there is now only one method signature that will require $options to be an array. - -**Please check and change your code accordingly!** +Please check and change your code accordingly! -Changes -======= +### Changes - Removed old deprecated methods: - AdminHandler::flushServerModuleCache() @@ -300,12 +296,12 @@ Changes - Graph::setEdgesCollection() - Graph::getEdgesCollection() - Handler::getCursorOptions() - + - Removed the old-style compatibility layer for parameter-passing in various methods that was used prior to switching to the $options parameter. This means, that wherever an $option array is passed to methods and a non-array type was also allowed (bool, string) for $options, the $options parameter **must** now be an array - it will not accept bool values or string values anymore, like for example a policy definition. - + - Performance might be a bit better due to the removal of the compatibility layer for $options. - + - Cleaned up and enriched annotations - Applied various smaller bug fixes @@ -313,48 +309,36 @@ Changes - GraphHandler: Optimized code to do less work when not necessary - GraphHandler: Implemented optional cache that caches the Vertex/Edge-Collections instead of making expensive calls to the DB. - GraphHandler: Is now batch-able. However, if any collections need to be fetched, they will be done out-of-batch. - If a lot of calls to the GraphHandler are being made, the use of the new caching functionality is encouraged. + If a lot of calls to the GraphHandler are being made, the use of the new caching functionality is encouraged. - Batches: Some work has been done, to optimize batches. This is still in development. - Switched from phpDocumentor to apigen - New Docs were generated +## Release notes for the ArangoDB-PHP driver 3.0.8 - -============================================================================================================ - - -Release notes for the ArangoDB-PHP driver 3.0.8 -=============================================== - This version of the driver is compatible with ArangoDB 3.0.x It is not compatible to earlier versions of ArangoDB (i.e. 2.x). Please use ones of the `2.x` branches of the driver for 2.x-compatibility. -Bug fixes -========= +### Bug fixes Fixed bug related to creating the correct collection type. This was no problem for the default, which is 'document', but it was a problem when the option 'createCollection'=>true was passed with save_edge(). -============================================================================================================ +## Release notes for the ArangoDB-PHP driver 3.0.7 -Release notes for the ArangoDB-PHP driver 3.0.7 -=============================================== - This version of the driver is compatible with ArangoDB 3.0.7 It is not compatible to earlier versions of ArangoDB (i.e. 2.x). Please use ones of the `2.x` branches of the driver for 2.x-compatibility. -Changed functionality -===================== +### Changed functionality -Batch processing ----------------- +**Batch processing** Added an option to pre-define a batch size for a batch. This results in the driver using an SplFixedArray for the storage of the batch parts, @@ -365,30 +349,62 @@ The option is called batchSize and accepts an integer. Example: $batch = new Batch($this->connection, ['batchSize' => 10000]); - -Bug fixes -========= +### Bug fixes Do to the many API changes in version 3 of ArangoDB, the driver had to go through a lot of changes too. This resulted in some inconsistencies in its functionality. Version 3.0.7 has hopefully dealt with them all. If there should be any more left, please create an issue to report it. -============================================================================================================ - +## Release notes for the ArangoDB-PHP driver 3.0 -Release notes for the ArangoDB-PHP driver 3.0 -============================================= This version of the driver is compatible with ArangoDB 3.0. It is not compatible to earlier versions of ArangoDB (i.e. 2.x). Please use ones of the `2.x` branches of the driver for 2.x-compatibility. -Changed functionality -===================== +### Changed functionality -User management ---------------- +**Graph Management** + +When replacing edges via the `EdgeHandler::replace()` method, it is now +required to specify both the `_from` and `_to` values of the replacing edge. +If either attribute is missing or invalid, the replace operation will fail +with an error `invalid edge attribute` on the server-side. + +That means the following may not work: + +```php +$edgeHandler = new EdgeHandler($connection); + +$edge = new Edge(); +$edge->set("_id", $idOfExistingEdge); +/* set some other edge attributes */ +... + +$result = $edgeHandler->replace($edge); +``` + +until at least `_from` and `_to` are also set via the `setFrom()` and `setTo()` +methods: + +```php +$edgeHandler = new EdgeHandler($connection); + +$edge = new Edge(); +$edge->set("_id", $idOfExistingEdge); +/* set some other edge attributes */ +... +$edge->setFrom($fromHandle); +$edge->setTo($toHandle); + +$result = $edgeHandler->replace($edge); +``` + +Note that this affects only the `replace()` and `replaceById()` methods and +not `update()` nor `updateById()`. + +**User management** The user management APIs in class `UserHandler` have changed slightly. The methods for adding, replacing and updating users had an optional parameter named `$options`, which did nothing. @@ -412,12 +428,9 @@ User permissions can be adjusted manually by using the following new methods of - UserHandler::grantPermissions($username, $databaseName) - UserHandler::revokePermissions($username, $databaseName) +### Unsupported functionality -Unsupported functionality -========================= - -Cap constraints ---------------- +**Cap constraints** Support for cap constraints has been discontinued on the 3.0 version of ArangoDB. Therefore, the following methods have also been removed from the PHP driver in @@ -427,8 +440,7 @@ the 3.0 branch: - CollectionHandler::first($collectionId, $count = null) - CollectionHandler::last($collectionId, $count = null) -Graph functions ---------------- +**Graph functions** The ArangoDB PHP driver provided PHP wrapper methods for common graph functions that were implemented server-side. When one of these wrapper methods was called, @@ -467,8 +479,7 @@ not limited to the subset of the functionality that was available in the "old" graph functions' interfaces, but can use the full functionality and composability of AQL. -Custom queues -------------- +**Custom queues** "Custom queues" were an undocumented, experimental feature in later versions of the 2.x driver. Its purpose was to send requests to dedicated processing @@ -483,8 +494,7 @@ PHP driver: - Connection::enableCustomQueue($queueName, $count = null) - Connection::disableCustomQueue() -Client versioning ------------------ +**Client versioning** The client-side versioning feature was also removed from the driver in version 3.0. The versioning feature allowed sending the HTTP header `X-Arango-Version` @@ -498,43 +508,3 @@ been removed from the driver's `Connection` class. - Connection::getVersion() - Connection::getClientVersion() - -Changed functionality -===================== - -When replacing edges via the `EdgeHandler::replace()` method, it is now -required to specify both the `_from` and `_to` values of the replacing edge. -If either attribute is missing or invalid, the replace operation will fail -with an error `invalid edge attribute` on the server-side. - -That means the following may not work: - -```php -$edgeHandler = new EdgeHandler($connection); - -$edge = new Edge(); -$edge->set("_id", $idOfExistingEdge); -/* set some other edge attributes */ -... - -$result = $edgeHandler->replace($edge); -``` - -until at least `_from` and `_to` are also set via the `setFrom()` and `setTo()` -methods: - -```php -$edgeHandler = new EdgeHandler($connection); - -$edge = new Edge(); -$edge->set("_id", $idOfExistingEdge); -/* set some other edge attributes */ -... -$edge->setFrom($fromHandle); -$edge->setTo($toHandle); - -$result = $edgeHandler->replace($edge); -``` - -Note that this affects only the `replace()` and `replaceById()` methods and -not `update()` nor `updateById()`. From df0f9c3e756d78c9ee2cae0edeaed709af46c642 Mon Sep 17 00:00:00 2001 From: Simran Brucherseifer Date: Tue, 22 Oct 2019 18:16:56 +0200 Subject: [PATCH 5/8] Formatting --- README.md | 12 ++++-- docs/Drivers/PHP/GettingStarted/README.md | 9 ++--- docs/Drivers/PHP/README.md | 9 +++-- docs/Drivers/PHP/Tutorial/README.md | 48 ++++++++--------------- 4 files changed, 35 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 24449574..67ef2177 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ ![ArangoDB-Logo](https://www.arangodb.com/docs/assets/arangodb_logo_2016_inverted.png) # ArangoDB-PHP - A PHP client for ArangoDB + The official ArangoDB PHP Driver. 3.2: [![Build Status](https://travis-ci.org/arangodb/arangodb-php.png?branch=3.2)](https://travis-ci.org/arangodb/arangodb-php) @@ -14,8 +15,13 @@ devel: [![Build Status](https://travis-ci.org/arangodb/arangodb-php.png?branch=d # More information -* More example code, containing some code to create, delete and rename collections, is provided in the [examples](examples) subdirectory that is provided with the library. +- More example code, containing some code to create, delete and rename + collections, is provided in the [examples](examples) subdirectory that is + provided with the library. -* [PHPDoc documentation](http://arangodb.github.io/arangodb-php/) for the complete library +- [PHPDoc documentation](http://arangodb.github.io/arangodb-php/) + for the complete library -* [Follow us on Twitter](https://twitter.com/arangodbphp) [@arangodbphp](https://twitter.com/arangodbphp) to receive updates on the PHP driver +- [Follow us on Twitter](https://twitter.com/arangodbphp) + [@arangodbphp](https://twitter.com/arangodbphp) + to receive updates on the PHP driver diff --git a/docs/Drivers/PHP/GettingStarted/README.md b/docs/Drivers/PHP/GettingStarted/README.md index 201f6247..81798fa8 100644 --- a/docs/Drivers/PHP/GettingStarted/README.md +++ b/docs/Drivers/PHP/GettingStarted/README.md @@ -1,4 +1,5 @@ # ArangoDB-PHP - Getting Started + ## Description This PHP client allows REST-based access to documents on the server. @@ -17,7 +18,7 @@ The client library provides document and collection classes you can use to work ## Requirements -* PHP version 5.6 or higher (Travis-tested with PHP 5.6, 7.0, 7.1 and hhvm) +- PHP version 5.6 or higher (Travis-tested with PHP 5.6, 7.0, 7.1 and hhvm) Note on PHP version support: @@ -33,8 +34,7 @@ The ArangoDB-PHP driver version has to match with the ArangoDB version: - ArangoDB-PHP 3.2.x is on par with the functionality of ArangoDB 3.2.x - ArangoDB-PHP 3.3.x is on par with the functionality of ArangoDB 3.3.x -etc... - +etc. ### Installing the PHP client @@ -50,13 +50,13 @@ There are two alternative ways to get the ArangoDB PHP client: ``` composer require triagens/arangodb ``` + #### Alternative 2: Cloning the git repository When preferring this alternative, you need to have a git client installed. To clone the ArangoDB PHP client repository from github, execute the following command in your project directory: git clone "https://github.com/arangodb/arangodb-php.git" - This will create a subdirectory arangodb-php in your current directory. It contains all the files of the client library. It also includes a dedicated autoloader that you can use for autoloading the client libraries class files. To invoke this autoloader, add the following line to your PHP files that will use the library: @@ -64,7 +64,6 @@ To invoke this autoloader, add the following line to your PHP files that will us require 'arangodb-php/autoload.php'; ``` - The ArangoDB PHP client's autoloader will only care about its own class files and will not handle any other files. That means it is fully nestable with other autoloaders. #### Alternative 3: Invoking the autoloader directly diff --git a/docs/Drivers/PHP/README.md b/docs/Drivers/PHP/README.md index 0873fab2..6fb8930b 100644 --- a/docs/Drivers/PHP/README.md +++ b/docs/Drivers/PHP/README.md @@ -1,4 +1,5 @@ # ArangoDB-PHP - A PHP client for ArangoDB + The official ArangoDB PHP Driver. - [Getting Started](GettingStarted/README.md) @@ -7,11 +8,11 @@ The official ArangoDB PHP Driver. # More information -* Check the ArangoDB PHP client on github.com regularly for new releases and updates: [https://github.com/arangodb/arangodb-php](https://github.com/arangodb/arangodb-php) +- Check the ArangoDB PHP client on github.com regularly for new releases and updates: [https://github.com/arangodb/arangodb-php](https://github.com/arangodb/arangodb-php) -* More example code, containing some code to create, delete and rename collections, is provided in the [examples](https://github.com/arangodb/arangodb-php/tree/devel/examples) subdirectory that is provided with the library. +- More example code, containing some code to create, delete and rename collections, is provided in the [examples](https://github.com/arangodb/arangodb-php/tree/devel/examples) subdirectory that is provided with the library. -* [PHPDoc documentation](http://arangodb.github.io/arangodb-php/) for the complete library +- [PHPDoc documentation](http://arangodb.github.io/arangodb-php/) for the complete library -* [Follow us on Twitter](https://twitter.com/arangodbphp) +- [Follow us on Twitter](https://twitter.com/arangodbphp) [@arangodbphp](https://twitter.com/arangodbphp) to receive updates on the PHP driver diff --git a/docs/Drivers/PHP/Tutorial/README.md b/docs/Drivers/PHP/Tutorial/README.md index b0aae139..80c47a55 100644 --- a/docs/Drivers/PHP/Tutorial/README.md +++ b/docs/Drivers/PHP/Tutorial/README.md @@ -1,4 +1,5 @@ # ArangoDB-PHP - Tutorial + ## Setting up the connection options In order to use ArangoDB, you need to specify the connection options. We do so by creating a PHP array $connectionOptions. Put this code into a file named test.php in your current directory: @@ -60,20 +61,19 @@ ArangoException::enableLogging(); This will make the client connect to ArangoDB -* running on localhost (OPTION_HOST) -* on the default port 8529 (OPTION_PORT) -* with a connection timeout of 3 seconds (OPTION_TIMEOUT) +- running on localhost (OPTION_HOST) +- on the default port 8529 (OPTION_PORT) +- with a connection timeout of 3 seconds (OPTION_TIMEOUT) When creating new documents in a collection that does not yet exist, you have the following choices: -* auto-generate a new collection: if you prefer that, set OPTION_CREATE to true -* fail with an error: if you prefer this behavior, set OPTION_CREATE to false +- auto-generate a new collection: if you prefer that, set OPTION_CREATE to true +- fail with an error: if you prefer this behavior, set OPTION_CREATE to false When updating a document that was previously/concurrently updated by another user, you can select between the following behaviors: -* last update wins: if you prefer this, set OPTION_UPDATE_POLICY to last -* fail with a conflict error: if you prefer that, set OPTION_UPDATE_POLICY to conflict - +- last update wins: if you prefer this, set OPTION_UPDATE_POLICY to last +- fail with a conflict error: if you prefer that, set OPTION_UPDATE_POLICY to conflict ## Setting up active failover @@ -132,7 +132,6 @@ $connectionOptions = [ ]; ``` - ## Creating a collection *This is just to show how a collection is created.* *For these examples it is not needed to create a collection prior to inserting a document, as we set ArangoConnectionOptions::OPTION_CREATE to true.* @@ -162,8 +161,8 @@ The below code will first set up the collection locally in a variable name $user // check if the collection exists $result = $collectionHandler->has('users'); var_dump($result); +``` - ``` ## Creating a document After we created the collection, we can start with creating an initial document. We will create a user document in a collection named "users". This collection does not need to exist yet. The first document we'll insert in this collection will create the collection on the fly. This is because we have set OPTION_CREATE to true in $connectionOptions. @@ -202,30 +201,29 @@ As you can see, sending a document to the server is achieved by calling the save ## Adding exception handling - The above code will work but it does not check for any errors. To make it work in the face of errors, we'll wrap it into some basic exception handlers ```php try { $handler = new ArangoDocumentHandler($connection); - + // create a new document $user = new ArangoDocument(); - + // use set method to set document properties $user->set('name', 'John'); $user->set('age', 25); - + // use magic methods to set document properties $user->likes = ['fishing', 'hiking', 'swimming']; - + // send the document to the server $id = $handler->save('users', $user); - + // check if a document exists $result = $handler->has('users', $id); var_dump($result); - + // print the document id created by the server var_dump($id); var_dump($user->getId()); @@ -291,7 +289,6 @@ Note that CollectionHandler->byExample() might return multiple documents if the ## Updating a document - To update an existing document, the update() method of the *DocumentHandler* class can be used. In this example we want to - set state to 'ca' @@ -389,12 +386,10 @@ Note that the document must have been fetched from the server before. If you hav } ``` - ## Running an AQL query - To run an AQL query, use the *Statement* class. - + The method Statement::execute creates a Cursor object which can be used to iterate over the query's result set. @@ -440,7 +435,6 @@ that cannot be converted into Document objects. In order to suppress the conversion into Document objects, the Statement must be given the `_flat` attribute. This allows processing the results of arbitrary AQL queries: - ```php // run an AQL query that does not return documents but scalars // we need to set the _flat attribute of the Statement in order for this to work @@ -460,17 +454,14 @@ the `_flat` attribute. This allows processing the results of arbitrary AQL queri ``` - ## Exporting data - To export the contents of a collection to PHP, use the *Export* class. The *Export* class will create a light-weight cursor over all documents of the specified collection. The results can be transferred to PHP in chunks incrementally. This is the most efficient way of iterating over all documents in a collection. - ```php // creates an export object for collection users $export = new ArangoExport($connection, 'users', []); @@ -504,12 +495,10 @@ over all documents in a collection. ## Bulk document handling - The ArangoDB-PHP driver provides a mechanism to easily fetch multiple documents from the same collection with a single request. All that needs to be provided is an array of document keys: - ```php $exampleCollection = new ArangoCollection(); $exampleCollection->setName('example'); @@ -536,11 +525,9 @@ of document keys: $result = $collectionHandler->removeByKeys('example', $keys); var_dump($result); - - ``` -## Dropping a collection +## Dropping a collection To drop an existing collection on the server, use the drop() method of the *CollectionHandler* class. drop() just needs the name of the collection name to be dropped: @@ -576,7 +563,6 @@ See file examples/customDocumentClass.php for more details. ## Logging exceptions - The driver provides a simple logging mechanism that is turned off by default. If it is turned on, the driver will log all its exceptions using PHP's standard `error_log` mechanism. It will call PHP's `error_log()` function for this. It depends on the PHP configuration if and where exceptions will be logged. Please consult From 56c0b72bfc6c390a50e557b9de716612c798d70b Mon Sep 17 00:00:00 2001 From: Simran Brucherseifer Date: Tue, 22 Oct 2019 18:25:37 +0200 Subject: [PATCH 6/8] More formatting --- CHANGELOG.md | 15 +++++++-------- docs/Drivers/PHP/Tutorial/README.md | 1 + 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b90db37..725b9a03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -132,21 +132,20 @@ removed its `__toString()` method. Starting with release 3.4.0, the following constants were removed from the `CollectionHandler` class: -* `OPTION_IGNORE_NULL` -* `OPTION_CONSTRAINT` +- `OPTION_IGNORE_NULL` +- `OPTION_CONSTRAINT` These constants were geo-index related, and the geo-index functionality changes in ArangoDB 3.4 have made these constants obsolete. For the same reason, the `createGeoIndex` function signature in the same class has changed from -``` -public function createGeoIndex($collectionId, array $fields, $geoJson = null, $constraint = null, $ignoreNull = null) -``` + + public function createGeoIndex($collectionId, array $fields, $geoJson = null, $constraint = null, $ignoreNull = null) + to just -``` -public function createGeoIndex($collectionId, array $fields, $geoJson = null) -``` + + public function createGeoIndex($collectionId, array $fields, $geoJson = null) Additionally the 3.4 release of the driver adds support for the following collection properties: diff --git a/docs/Drivers/PHP/Tutorial/README.md b/docs/Drivers/PHP/Tutorial/README.md index 80c47a55..05d63cd4 100644 --- a/docs/Drivers/PHP/Tutorial/README.md +++ b/docs/Drivers/PHP/Tutorial/README.md @@ -95,6 +95,7 @@ $connectionOptions = [ ConnectionOptions::OPTION_ENDPOINT => [ 'tcp://localhost:8531', 'tcp://localhost:8532', 'tcp://localhost:8530' ] ]; ``` + Using this option requires ArangoDB 3.3 or higher and the database running in active failover mode. From d8f8185cf21e3c75738622882e5ef025578a5af6 Mon Sep 17 00:00:00 2001 From: Simran Brucherseifer Date: Tue, 22 Oct 2019 19:50:11 +0200 Subject: [PATCH 7/8] Empty line --- docs/Drivers/PHP/Tutorial/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Drivers/PHP/Tutorial/README.md b/docs/Drivers/PHP/Tutorial/README.md index 05d63cd4..2c70db74 100644 --- a/docs/Drivers/PHP/Tutorial/README.md +++ b/docs/Drivers/PHP/Tutorial/README.md @@ -134,6 +134,7 @@ $connectionOptions = [ ``` ## Creating a collection + *This is just to show how a collection is created.* *For these examples it is not needed to create a collection prior to inserting a document, as we set ArangoConnectionOptions::OPTION_CREATE to true.* From 18b774d9c75c443de44a5e039588ca6685094930 Mon Sep 17 00:00:00 2001 From: Simran Brucherseifer Date: Thu, 24 Oct 2019 13:54:03 +0200 Subject: [PATCH 8/8] Capitalization --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 725b9a03..28df2817 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -171,7 +171,7 @@ unique constraint violation error on the primary key. The method `insert` was introduced in `DocumentHandler` as an alias for the existing `save` method to be consistent with the server-side method naming. -Basic support for arangosearch views was added in 3.4.0, via the `View` and `ViewHandler` +Basic support for Arangosearch Views was added in 3.4.0, via the `View` and `ViewHandler` classes.
linkhttps://docs.arangodb.com/HTTP/Traversal/index.htmlhttps://www.arangodb.com/docs/stable/http/traversal.html
package