Value object representing an edge Definition.

An edge definition contains a collection called 'relation' to store the edges and multiple vertices collection defined in 'fromCollections' and 'toCollections'.


package ArangoDBClient
since 2.2

 Methods

Constructs an new edge definition

__construct(string $relation = null, array|string $fromCollections = array(), array|string $toCollections = array()
since 2.2

Parameters

$relation

string
  • name of the relation (the underlying edge collection).

$fromCollections

arraystring
  • a list of collections providing the edges start vertices or a string holding a single collection name.

$toCollections

arraystring
  • a list of collections providing the edges end vertices or a string holding a single collection name.

Add a 'from' collections of the graph.

addFromCollection(string $fromCollection) 
since 2.2

Parameters

$fromCollection

string
  • the name of the added collection.

Add a 'to' collections of the graph.

addToCollection(string $toCollection) 
since 2.2

Parameters

$toCollection

string
  • the name of the added collection.

Resets the 'from' collections of the graph.

clearFromCollection() 
since 2.2

Resets the 'to' collections of the graph.

clearToCollection() 
since 2.2

Constructs a directed relation. This relation is an edge definition where the edges can start only in the vertices defined in 'fromCollections' and end in vertices defined in 'toCollections'.

createDirectedRelation(string $relation, array|string $fromCollections, array|string $toCollections) : \ArangoDBClient\EdgeDefinition
Static
since 2.2

Parameters

$relation

string
  • name of the relation (the underlying edge collection).

$fromCollections

arraystring
  • a list of collections providing the edges start vertices or a string holding a single collection name.

$toCollections

arraystring
  • a list of collections providing the edges end vertices or a string holding a single collection name.

Returns

\ArangoDBClient\EdgeDefinition

Constructs an undirected relation. This relation is an edge definition where the edges can start and end in any vertex from the collection list.

createUndirectedRelation(string $relation, array $vertexCollections) : \ArangoDBClient\EdgeDefinition
Static
since 2.2

Parameters

$relation

string
  • name of the relation (the underlying edge collection).

$vertexCollections

array
  • a list of collections providing the edges start and end vertices.

Returns

\ArangoDBClient\EdgeDefinition

Get the 'from' collections of the graph.

getFromCollections() : array
since 2.2

Returns

array

Get the relation of the edge definition.

getRelation() : string
since 2.2

Returns

string

Get the 'to' collections of the graph.

getToCollections() : array
since 2.2

Returns

array

Set the relation of the edge definition

setRelation(string $relation) 
since 2.2

Parameters

$relation

string
  • the name of the relation.

Transforms an edge definition to an array.

transformToArray() : array
since 2.2

Returns

array

 Properties

 

An array containing the names of the vertices collections holding the start vertices.

$_fromCollections : array

Default

array()
 

The name of the edge collection for this relation.

$_relation : string

Default

 

An array containing the names of the vertices collections holding the end vertices.

$_toCollections : array

Default

array()