Arango PHP ODM

Graph
in package
implements JsonSerializable

Represents an ArangoDB Graph.

Tags
author

Lucas S. Vieira

Table of Contents

Interfaces

JsonSerializable

Methods

__construct()  : mixed
Graph constructor.
__toString()  : string
Returns a string representation of graph object.
addEdge()  : bool
Creates a new edge in the collection.<br> Within the attributes the edge has to contain a _from and _to value referencing to valid vertices in the graph Furthermore, the edge has to be valid in the definition of the used.
addEdgeDefinition()  : bool
Adds an edge definition to graph.
addVertex()  : bool
Adds a vertex to graph.
addVertexCollection()  : bool
Adds a vertex collection to the set of orphan collections of the graph.
delete()  : bool
Removes a graph from server, if possible.
dropEdge()  : bool
Drops an edge from graph.
dropEdgeDefinition()  : bool
Remove one edge definition from the graph<br> This will only remove the edge collection, the vertex collections remain untouched and can still be used in your queries.
dropVertex()  : bool
Drops a vertex from graph.
dropVertexCollection()  : bool
Removes a vertex collection from the graph and optionally deletes the collection, if it is not used in any other graph<br> It can only remove vertex collections that are no longer part of edge definitions,<br> if they are used in edge definitions you are required to modify those first.
getEdge()  : Edge|false
Returns an edge document.
getEdgeDefinitions()  : ArrayList
Return all edge definitions of graph.
getId()  : string
Returns the graph ID.
getKey()  : string
Returns the graph key.
getMinReplicationFactor()  : int
Returns the minimal replication factor used for every new collection in the graph.
getName()  : string
Gets the graph name.
getNumberOfShards()  : int
Returns the number of shards that is used for every collection within this graph.
getOrphanCollections()  : array<string|int, mixed>
Returns the orphan collections in the graph.
getReplicationFactor()  : int
Returns the replication factor used when initially creating collections for this graph.
getRevision()  : string
Gets the graph revision.
getVertex()  : Vertex|false
Gets a vertex from the given collection.
getVertexCollections()  : ArrayList
Lists all vertex collections within this graph.
isNew()  : bool
Returns true if is a new graph.
isSmart()  : bool
If this graph is a smartGraph.
jsonSerialize()  : array<string|int, mixed>|mixed
Return a JSON representation of graph attributes.
save()  : bool
Save the Graph on server, if possible.
toArray()  : array<string|int, mixed>
Returns a array representation of graph.
traversal()  : Traversal
Returns a graph traversal.

Methods

__toString()

Returns a string representation of graph object.

public __toString() : string
Return values
string

addEdge()

Creates a new edge in the collection.<br> Within the attributes the edge has to contain a _from and _to value referencing to valid vertices in the graph Furthermore, the edge has to be valid in the definition of the used.

public addEdge(string $collection[, array<string|int, mixed> $attributes = [] ][, bool $waitForSync = true ][, bool $returnNew = false ]) : bool
Parameters
$collection : string

The name of the edge collection the edge belongs to.

$attributes : array<string|int, mixed> = []

The object attributes to be stored. Must contain '_to' and '_from' keys.

$waitForSync : bool = true

Define if the request should wait until synced to disk. Default is true.

$returnNew : bool = false

Define if the response should contain the complete new version of the document. Default is false.

Tags
throws
DatabaseException|GuzzleException|Exception
Return values
bool

True if Edge object exists. False if no graph with this name could be found
or this collection is not part of the graph or one of the vertices ('_to' or '_from') does not exist.

addEdgeDefinition()

Adds an edge definition to graph.

public addEdgeDefinition(string $collection, array<string|int, mixed> $from, array<string|int, mixed> $to) : bool
Parameters
$collection : string

Edge collection name.

$from : array<string|int, mixed>

List of vertex collection names.

$to : array<string|int, mixed>

List of vertex collection names.

Tags
throws
DatabaseException|GuzzleException
Return values
bool

addVertex()

Adds a vertex to graph.

public addVertex(string $collection[, array<string|int, mixed> $attributes = [] ][, bool $waitForSync = true ][, bool $returnNew = true ]) : bool
Parameters
$collection : string

The name of the vertex collection the vertex should be inserted into.

$attributes : array<string|int, mixed> = []

The object attributes to be stored.

$waitForSync : bool = true

Define if the request should wait until synced to disk. Default is true.

$returnNew : bool = true

Define if the response should contain the complete new version of the document. Default is true.

Tags
throws
DatabaseException|GuzzleException|Exception
Return values
bool

True if the vertex could be added. False if no graph with this name could be found
or if a graph is found but the collection is not part of the graph.

addVertexCollection()

Adds a vertex collection to the set of orphan collections of the graph.

public addVertexCollection(string $collection) : bool

If the collection does not exist, it will be created.

Parameters
$collection : string

The name of the vertex collection.

Tags
throws
DatabaseException|GuzzleException|Exception
Return values
bool

delete()

Removes a graph from server, if possible.

public delete([bool $dropCollections = false ]) : bool
Parameters
$dropCollections : bool = false

If set true, drop collections of this graph as well.
Collections will only be dropped if they are not used in other graphs.

Tags
throws
DatabaseException|GuzzleException|Exception
Return values
bool

True if operation was successful, false otherwise.

dropEdge()

Drops an edge from graph.

public dropEdge(string $collection, string $edge[, bool $waitForSync = true ][, bool $returnOld = false ]) : bool
Parameters
$collection : string

The name of the edge collection the edge belongs to.

$edge : string

The _key attribute of the edge.

$waitForSync : bool = true

Define if the request should wait until synced to disk. Default is true.

$returnOld : bool = false

Define if the response should contain the complete new version of the document. Default is false.

Tags
throws
DatabaseException|GuzzleException|Exception
Return values
bool

True if the edge could be removed. False if no graph with this name could be found
or if a graph is found but the collection is not part of the graph.

dropEdgeDefinition()

Remove one edge definition from the graph<br> This will only remove the edge collection, the vertex collections remain untouched and can still be used in your queries.

public dropEdgeDefinition(string $collection[, bool $dropCollection = false ][, bool $waitForSync = true ]) : bool
Parameters
$collection : string

Edge collection name.

$dropCollection : bool = false

Drop the collection as well. Collection will only be dropped if it is not used in other graphs.

$waitForSync : bool = true

Define if the request should wait until synced to disk.

Tags
throws
DatabaseException|GuzzleException
Return values
bool

dropVertex()

Drops a vertex from graph.

public dropVertex(string $collection, string $vertex[, bool $waitForSync = true ][, bool $returnOld = false ]) : bool
Parameters
$collection : string

The name of the vertex collection the vertex belongs to.

$vertex : string

The _key attribute of the vertex.

$waitForSync : bool = true

Define if the request should wait until synced to disk. Default is true.

$returnOld : bool = false

Define if the response should contain the complete new version of the document. Default is false.

Tags
throws
DatabaseException|GuzzleException|Exception
Return values
bool

True if the vertex could be removed. False if no graph with this name could be found
or if a graph is found but the collection is not part of the graph.

dropVertexCollection()

Removes a vertex collection from the graph and optionally deletes the collection, if it is not used in any other graph<br> It can only remove vertex collections that are no longer part of edge definitions,<br> if they are used in edge definitions you are required to modify those first.

public dropVertexCollection(string $collection[, bool $dropCollection = false ]) : bool
Parameters
$collection : string

The name of the vertex collection.

$dropCollection : bool = false

Drop the collection as well. Collection will only be dropped if it is not used in other graphs.

Tags
throws
DatabaseException|GuzzleException|Exception
Return values
bool

getEdge()

Returns an edge document.

public getEdge(string $collection, string $edge) : Edge|false
Parameters
$collection : string

The name of the edge collection the edge belongs to.

$edge : string

The _key attribute of the edge.

Tags
throws
DatabaseException|GuzzleException|Exception|MissingParameterException|InvalidParameterException
Return values
Edge|false

A Edge object if edge exists. False if no graph with this name could be found
or this collection is not part of the graph or the edge does not exist.

getEdgeDefinitions()

Return all edge definitions of graph.

public getEdgeDefinitions() : ArrayList
Return values
ArrayList

getId()

Returns the graph ID.

public getId() : string
Return values
string

getKey()

Returns the graph key.

public getKey() : string
Return values
string

getMinReplicationFactor()

Returns the minimal replication factor used for every new collection in the graph.

public getMinReplicationFactor() : int
Return values
int

getName()

Gets the graph name.

public getName() : string
Return values
string

getNumberOfShards()

Returns the number of shards that is used for every collection within this graph.

public getNumberOfShards() : int
Return values
int

getOrphanCollections()

Returns the orphan collections in the graph.

public getOrphanCollections() : array<string|int, mixed>
Return values
array<string|int, mixed>

getReplicationFactor()

Returns the replication factor used when initially creating collections for this graph.

public getReplicationFactor() : int
Return values
int

getRevision()

Gets the graph revision.

public getRevision() : string
Return values
string

getVertex()

Gets a vertex from the given collection.

public getVertex(string $collection, string $vertex) : Vertex|false
Parameters
$collection : string

The name of the vertex collection the vertex belongs to.

$vertex : string

The _key attribute of the vertex.

Tags
throws
DatabaseException|GuzzleException|InvalidParameterException|MissingParameterException
Return values
Vertex|false

A Vertex object if vertex exists. False if no graph with this name could be found
or this collection is not part of the graph or the vertex does not exist.

isNew()

Returns true if is a new graph.

public isNew() : bool
Return values
bool

isSmart()

If this graph is a smartGraph.

public isSmart() : bool
Return values
bool

jsonSerialize()

Return a JSON representation of graph attributes.

public jsonSerialize() : array<string|int, mixed>|mixed
Return values
array<string|int, mixed>|mixed

save()

Save the Graph on server, if possible.

public save() : bool
Tags
throws
DatabaseException|GuzzleException|Exception
Return values
bool

True if operation was successful, false otherwise.

toArray()

Returns a array representation of graph.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

traversal()

Returns a graph traversal.

public traversal(Vertex $vertex[, string $direction = Traversal::GRAPH_DIRECTION_ANY ][, int $depth = 0 ]) : Traversal
Parameters
$vertex : Vertex

The start vertex.

$direction : string = Traversal::GRAPH_DIRECTION_ANY

Direction for traversal. Must be either "outbound", "inbound", or "any".

$depth : int = 0

Visits only nodes in at least the given depth.

Tags
throws
CursorException|GuzzleException|Exception
Return values
Traversal

        
On this page

Search results