Provides graph traversal

A Traversal object is used to execute a graph traversal on the server side.

The object requires the connection object, the startVertex, the edgeCollection and the optional parameters.

link https://docs.arangodb.com/HTTP/Traversal/index.html
package ArangoDBClient
since 1.4

 Methods

Initialise the Traversal object

__construct(\ArangoDBClient\Connection $connection, string $startVertex, string $edgeCollection, array $options = null

Parameters

$connection

\ArangoDBClient\Connection
  • the connection to be used

$startVertex

string
  • user function initialization data

$edgeCollection

string
  • user function initialization data

$options

array

Exceptions

\ArangoDBClient\ClientException

Get an attribute, magic method

__get(string $key) : mixed

This function is mapped to get() internally.

magic

Parameters

$key

string
  • name of attribute

Returns

mixed- value of attribute, NULL if attribute is not set

Is triggered by calling isset() or empty() on inaccessible properties.

__isset(string $key) : boolean

Parameters

$key

string
  • name of attribute

Returns

booleanreturns true or false (set or not set)

Set an attribute, magic method

__set(string $key, mixed $value) : void

This is a magic method that allows the object to be used without declaring all attributes first.

magic

Parameters

$key

string
  • attribute name

$value

mixed
  • value for attribute

Exceptions

\ArangoDBClient\ClientException

Returns the action string

__toString() : string
magic

Returns

string- the current action string

Get an attribute

get(string $key) : mixed
magic

Parameters

$key

string
  • name of attribute

Returns

mixed- value of attribute, NULL if attribute is not set

Get user function code

getEdgeCollection() : string

Returns

stringname

Execute and get the traversal result

getResult() : array

Exceptions

\ArangoDBClient\Exception
\ArangoDBClient\ClientException

Returns

array$responseArray

Get name value

getStartVertex() : string

Returns

stringname

Set an attribute

set($key, $value) 

Parameters

$key

$value

Exceptions

\ArangoDBClient\ClientException

Set user function code

setEdgeCollection(string $value) 

Parameters

$value

string

Exceptions

\ArangoDBClient\ClientException

Set name of the user function. It must have at least one namespace, but also can have sub-namespaces.

setStartVertex(string $value) 

correct: 'myNamespace:myFunction' 'myRootNamespace:mySubNamespace:myFunction'

wrong: 'myFunction'

Parameters

$value

string

Exceptions

\ArangoDBClient\ClientException

Return the connection object

getConnection() : \ArangoDBClient\Connection

Returns

\ArangoDBClient\Connection- the connection object

 Properties

 

string The action property of the traversal.

$_action : 

Default

 

The traversal's attributes.

$attributes : array

Default

array()
 

The connection object

$_connection : \ArangoDBClient\Connection

Default

 Constants

 

Action index

ENTRY_EDGECOLLECTION = 'edgeCollection' 
 

Collections index

ENTRY_STARTVERTEX = 'startVertex' 
 

count fields

OPTION_FIELDS = 'fields'