A handler that manages graphs.
package | ArangoDBClient |
---|---|
since | 1.2 |
inherited_from | \ArangoDBClient\Handler |
__construct(\ArangoDBClient\Connection $connection)
\ArangoDBClient\Connection
addEdgeDefinition(mixed $graph, \ArangoDBClient\EdgeDefinition $edgeDefinition) : \ArangoDBClient\Graph
This will add a further edge definition to the graph.
since | 2.2 |
---|
mixed
\ArangoDBClient\EdgeDefinition
\ArangoDBClient\Exception |
---|
\ArangoDBClient\Graph
addOrphanCollection(mixed $graph, string $orphanCollection) : \ArangoDBClient\Graph
This will add a further orphan collection to the graph.
since | 2.2 |
---|
mixed
string
\ArangoDBClient\Exception |
---|
\ArangoDBClient\Graph
clearCache() : \ArangoDBClient\GraphHandler
fluent | This method is part of a fluent interface and will return the same instance |
---|
\ArangoDBClient\GraphHandler
createGraph(\ArangoDBClient\Graph $graph) : array
This will create a graph using the given graph object and return an array of the created graph object's attributes.
since | 1.2 |
---|
\ArangoDBClient\Graph
\ArangoDBClient\Exception |
---|
array
deleteEdgeDefinition(mixed $graph, string $edgeDefinition, boolean $dropCollection = false
) : \ArangoDBClient\Graph
This will delete an edge definition from the graph.
since | 2.2 |
---|
mixed
string
boolean
\ArangoDBClient\Exception |
---|
\ArangoDBClient\Graph
deleteOrphanCollection(mixed $graph, string $orphanCollection, boolean $dropCollection = false
) : \ArangoDBClient\Graph
This will delete an orphan collection from the graph.
since | 2.2 |
---|
mixed
string
boolean
\ArangoDBClient\Exception |
---|
\ArangoDBClient\Graph
dropGraph(mixed $graph, boolean $dropCollections = true
) : boolean
since | 1.2 |
---|
mixed
boolean
\ArangoDBClient\Exception |
---|
boolean
- always true, will throw if there is an errorgetCacheEnabled() : boolean
boolean
getEdge(mixed $graph, mixed $edgeId, array $options= array()
, string $collection= null
) : \ArangoDBClient\Document
This will throw if the edge cannot be fetched from the server
since | 1.2 |
---|
mixed
mixed
array
optional, array of options
string
\ArangoDBClient\Exception |
---|
\ArangoDBClient\Document
- the edge document fetched from the servergetEdgeCollections(mixed $graph) : array
This will get all edge collections from the graph.
If this method or any method that calls this method is used in batch mode and caching is off,
then for each call, this method will make an out of batch API call to the db in order to get the appropriate collections.
If caching is on, then the GraphHandler will only call the DB API once for the chosen graph, and return data from cache for the following calls.
since | 2.2 |
---|
mixed
\ArangoDBClient\Exception |
---|
array
getGraph(String $graph, array $options = array()
) : \ArangoDBClient\Graph | false
This will get a graph.
since | 1.2 |
---|
String
array
\ArangoDBClient\ClientException |
---|
\ArangoDBClient\Graph
false
getVertex(mixed $graph, mixed $vertexId, array $options= array()
, string $collection= null
) : \ArangoDBClient\Document
This will throw if the vertex cannot be fetched from the server
since | 1.2 |
---|
mixed
mixed
array
optional, an array of options:
string
\ArangoDBClient\Exception |
---|
\ArangoDBClient\Document
getVertexCollections(mixed $graph, array $options = array()
) : array
This will get all vertex collection (orphans and used in edge definitions) from the graph.
If this method or any method that calls this method is used in batch mode and caching is off,
then for each call, this method will make an out of batch API call to the db in order to get the appropriate collections.
If caching is on, then the GraphHandler will only call the DB API once for the chosen graph, and return data from cache for the following calls.
mixed
array
Options are :
\ArangoDBClient\ClientException@since |
2.2 |
---|
array
hasEdge(mixed $graph, mixed $edgeId) : boolean
This will call self::getEdge() internally and checks if there was an exception thrown which represents an 404 request.
mixed
mixed
\ArangoDBClient\Exception |
When any other error than a 404 occurs |
---|
boolean
hasVertex(mixed $graph, mixed $vertexId) : boolean
This will call self::getVertex() internally and checks if there was an exception thrown which represents an 404 request.
mixed
mixed
\ArangoDBClient\Exception |
When any other error than a 404 occurs |
---|
boolean
properties(mixed $graph) : boolean
since | 1.2 |
---|
mixed
\ArangoDBClient\Exception |
---|
boolean
- Returns an array of attributes. Will throw if there is an errorremoveEdge(mixed $graph, mixed $edgeId, mixed $revision= null
, mixed $options= array()
, string $collection= null
) : boolean
since | 1.2 |
---|
mixed
mixed
mixed
mixed
optional, array of options (see below) or the boolean value for $policy (for compatibility prior to version 1.1 of this method)
string
\ArangoDBClient\Exception |
---|
boolean
- always true, will throw if there is an errorremoveVertex(mixed $graph, mixed $vertexId, mixed $revision= null
, mixed $options= array()
, string $collection= null
) : boolean
since | 1.2 |
---|
mixed
mixed
mixed
mixed
optional, an array of options (see below) or the boolean value for $policy (for compatibility prior to version 1.1 of this method)
string
\ArangoDBClient\Exception |
---|
boolean
- always true, will throw if there is an errorreplaceEdge(mixed $graph, mixed $edgeId, mixed $label, \ArangoDBClient\Edge $document, mixed $options= array()
, string $collection= null
) : boolean
This will replace the edge on the server
This will throw if the edge cannot be Replaced
If policy is set to error (locally or globally through the ConnectionOptions)
and the passed document has a _rev value set, the database will check
that the revision of the to-be-replaced edge is the same as the one given.
since | 1.2 |
---|
mixed
mixed
mixed
\ArangoDBClient\Edge
mixed
optional, array of options (see below) or the boolean value for $policy (for compatibility prior to version 1.1 of this method)
string
\ArangoDBClient\Exception |
---|
boolean
- always true, will throw if there is an errorreplaceEdgeDefinition(mixed $graph, \ArangoDBClient\EdgeDefinition $edgeDefinition) : \ArangoDBClient\Graph
This will replace an edge definition in the graph.
since | 2.2 |
---|
mixed
\ArangoDBClient\EdgeDefinition
\ArangoDBClient\Exception |
---|
\ArangoDBClient\Graph
replaceVertex(mixed $graph, mixed $vertexId, \ArangoDBClient\Document $document, mixed $options= array()
, string $collection= null
) : boolean
This will update the vertex on the server
If policy is set to error (locally or globally through the ConnectionOptions)
and the passed document has a _rev value set, the database will check
that the revision of the to-be-replaced vertex is the same as the one given.
since | 1.2 |
---|
mixed
mixed
\ArangoDBClient\Document
mixed
optional, an array of options (see below) or the boolean value for $policy (for compatibility prior to version 1.1 of this method):
string
\ArangoDBClient\Exception |
---|
boolean
- always true, will throw if there is an errorsaveEdge(mixed $graph, mixed $from, mixed $to, mixed $label= null
, mixed $document, string $collection= null
) : mixed
This will save the edge to the graph and return the edges-document's id
This will throw if the edge cannot be saved
since | 1.2 |
---|
mixed
mixed
mixed
mixed
mixed
string
\ArangoDBClient\Exception |
---|
mixed
- id of edge createdsaveVertex(mixed $graph, mixed $document, string $collection = null
) : string
This will add the vertex-document to the graph and return the vertex id
This will throw if the vertex cannot be saved
since | 1.2 |
---|
mixed
mixed
string
\ArangoDBClient\Exception |
---|
string
- id of vertex createdsetBatchsize(integer $batchsize)
Will be reset after the cursor has been created.
integer
setCacheEnabled(boolean $useCache) : \ArangoDBClient\GraphHandler
fluent | This method is part of a fluent interface and will return the same instance |
---|
boolean
\ArangoDBClient\GraphHandler
setCount(integer $count)
Will be reset after the cursor has been created.
integer
setDocumentClass(string $class) : \ArangoDBClient\DocumentClassable
string
Document class to use
\ArangoDBClient\DocumentClassable
setEdgeClass(string $class) : \ArangoDBClient\DocumentClassable
string
Edge class to use
\ArangoDBClient\DocumentClassable
setLimit(integer $limit)
Will be reset after the cursor has been created.
integer
updateEdge(mixed $graph, mixed $edgeId, mixed $label, \ArangoDBClient\Edge $document, mixed $options= array()
, string $collection= null
) : boolean
This will update the edge on the server
This will throw if the edge cannot be updated
If policy is set to error (locally or globally through the ConnectionOptions)
and the passed edge-document has a _rev value set, the database will check
that the revision of the to-be-replaced document is the same as the one given.
since | 1.2 |
---|
mixed
mixed
mixed
\ArangoDBClient\Edge
mixed
optional, array of options (see below)
string
\ArangoDBClient\Exception |
---|
boolean
- always true, will throw if there is an errorupdateVertex(mixed $graph, mixed $vertexId, \ArangoDBClient\Document $document, mixed $options= array()
, string $collection= null
) : boolean
This will update the vertex on the server
This will throw if the vertex cannot be updated
If policy is set to error (locally or globally through the ConnectionOptions)
and the passed vertex-document has a _rev value set, the database will check
that the revision of the to-be-replaced document is the same as the one given.
since | 1.2 |
---|
mixed
mixed
\ArangoDBClient\Document
mixed
optional, an array of options (see below)
string
\ArangoDBClient\Exception |
---|
boolean
- always true, will throw if there is an erroraddTransactionHeader(array $headers, mixed $collection)
array
mixed
getConnection() : \ArangoDBClient\Connection
\ArangoDBClient\Connection
- the connection objectgetConnectionOption($optionName) : mixed
\ArangoDBClient\ClientException |
---|
mixed
- the option's valueincludeOptionsInBody(array $options, array $body, array $includeArray = array()
) : array
Only options that are set in $includeArray will be included. This is only for options that are to be sent to the ArangoDB server in a json body(like 'limit', 'skip', etc...) .
array
array
array
array
$params - array of parameters for use in a urljson_encode_wrapper(array $body) : string
This is a convenience function that calls json_encode_wrapper on the connection
array
\ArangoDBClient\ClientException |
---|
string
- json string of the body that was passedmakeCollection(mixed $value) : string
mixed
\ArangoDBClient\ClientException |
---|
string
- collection name$_documentClass : string
'\ArangoDBClient\Document'
$_edgeClass : string
'\ArangoDBClient\Edge'
$cache
$cacheEnabled :
false
$_connection
param |
---|
$batchsize
$count
$limit
ENTRY_GRAPH = 'graph'
KEY_FROM = '_from'
KEY_TO = '_to'
OPTION_COLLECTION = 'collection'
OPTION_COLLECTIONS = 'collections'
OPTION_DROP_COLLECTION = 'dropCollection'
OPTION_EDGES = 'edges'
OPTION_EDGE_DEFINITION = 'edgeDefinition'
OPTION_EDGE_DEFINITIONS = 'edgeDefinitions'
OPTION_KEY = '_key'
OPTION_NAME = 'name'
OPTION_ORPHAN_COLLECTIONS = 'orphanCollections'
OPTION_REVISION = 'revision'
OPTION_VERTICES = 'vertices'