Skip to content

Commit ca94782

Browse files
committed
adjusted graph functions, updated CHANGELOG
1 parent 0447b78 commit ca94782

File tree

8 files changed

+77
-2385
lines changed

8 files changed

+77
-2385
lines changed

CHANGELOG

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Release notes for the ArangoDB-PHP driver 3.0
32
=============================================
43

@@ -20,6 +19,46 @@ the 3.0 branch:
2019
- CollectionHandler::first($collectionId, $count = null)
2120
- CollectionHandler::last($collectionId, $count = null)
2221

22+
Graph functions
23+
---------------
24+
25+
The ArangoDB PHP driver provided PHP wrapper methods for common graph functions
26+
that were implemented server-side. When one of these wrapper methods was called,
27+
the PHP driver assembled an AQL query that called the equivalent graph AQL functions
28+
on the server. The driver has provided some extra post-filtering options for some
29+
of the graph functions, but for others it only provided a subset of the features
30+
available server-side.
31+
32+
With ArangoDB 3.0, the graph functionality on the server-side has changed: the
33+
previously available AQL graph functions that were called by the PHP driver are
34+
not available anymore in 3.0. This affects the following previously existing
35+
methods of the PHP driver's `GraphHandler` class, which are now gone in 3.0:
36+
37+
- GraphHandler::getNeighborVertices($graph, $vertexExample, $options = array())
38+
- GraphHandler::getConnectedEdges($graph, $vertexId, $options = array())
39+
- GraphHandler::getVertices($graph, $options = array())
40+
- GraphHandler::getEdges($graph, $options = array())
41+
- GraphHandler::getPaths($graph, $options = array())
42+
- GraphHandler::getShortestPaths($graph, $startVertexExample = array(), $endVertexExample = array(), $options = array())
43+
- GraphHandler::getDistanceTo($graph, $startVertexExample = null, $endVertexExample = null, $options = array())
44+
- GraphHandler::getCommonNeighborVertices($graph, $vertex1Example = null, $vertex2Example = null, $options1 = array(),$options2 = array())
45+
- GraphHandler::getCommonProperties($graph, $vertex1Example= null, $vertex2Example = null, $options = array())
46+
- GraphHandler::getAbsoluteEccentricity($graph, $vertexExample = null, $options = array())
47+
- GraphHandler::getEccentricity($graph, $options = array())
48+
- GraphHandler::getAbsoluteCloseness($graph, $vertexExample = null, $options = array())
49+
- GraphHandler::getCloseness($graph, $options = array())
50+
- GraphHandler::getAbsoluteBetweenness($graph, $options = array())
51+
- GraphHandler::getBetweenness($graph, $options = array())
52+
- GraphHandler::getRadius($graph, $options = array())
53+
- GraphHandler::getDiameter($graph, $options = array())
54+
55+
Most of these methods can be emulated by issuing an AQL query from the PHP driver.
56+
AQL provides provides blocks for computing the vertices, connected edges, and paths
57+
in a graph or just dedicated collections. As a bonus, by using AQL queries one is
58+
not limited to the subset of the functionality that was available in the "old"
59+
graph functions' interfaces, but can use the full functionality and composability
60+
of AQL.
61+
2362
Custom queues
2463
-------------
2564

lib/triagens/ArangoDb/Database.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ class Database
2626
* Databases index
2727
*/
2828
const ENTRY_DATABASE_NAME = 'name';
29+
30+
/**
31+
* Users index
32+
*/
33+
const ENTRY_DATABASE_USERS = 'users';
2934

3035
/**
3136
* creates a database
@@ -41,7 +46,13 @@ class Database
4146
*/
4247
public static function create(Connection $connection, $name)
4348
{
44-
$payload = array(self::ENTRY_DATABASE_NAME => $name);
49+
$payload = array(self::ENTRY_DATABASE_NAME => $name,
50+
self::ENTRY_DATABASE_USERS => array(
51+
array(
52+
"username" => $connection->getOption(ConnectionOptions::OPTION_AUTH_USER),
53+
"passwd" => $connection->getOption(ConnectionOptions::OPTION_AUTH_PASSWD)
54+
)
55+
));
4556

4657
$response = $connection->post(Urls::URL_DATABASE, $connection->json_encode_wrapper($payload));
4758

@@ -87,6 +98,22 @@ public static function delete(Connection $connection, $name)
8798
* @return array $responseArray - The response array.
8899
*/
89100
public static function listDatabases(Connection $connection)
101+
{
102+
return self::databases($connection);
103+
}
104+
105+
/**
106+
* List databases
107+
*
108+
* This will list the databases that exist on the server
109+
*
110+
* @param Connection $connection - the connection to be used
111+
*
112+
* @link http://www.arangodb.com/manuals/1.4/HttpDatabase.html
113+
*
114+
* @return array $responseArray - The response array.
115+
*/
116+
public static function databases(Connection $connection)
90117
{
91118
$response = $connection->get(Urls::URL_DATABASE);
92119

0 commit comments

Comments
 (0)