Edge extends Document
Immutable value object wrapping a single ArangoDB edge document.
Extends Document with accessors for the two reserved edge
attributes (_from, _to), which point to the source and target
vertex identifiers respectively.
Example:
$edge = new Edge
(
[
Schema::_KEY => 'e1' ,
Schema::_ID => 'follows/e1' ,
Schema::_FROM => 'users/alice' ,
Schema::_TO => 'users/bob' ,
'since' => '2026-01-01' ,
]
) ;
$edge->getFrom() ; // 'users/alice'
$edge->getTo() ; // 'users/bob'
$edge->get( 'since' ) ; // '2026-01-01'
Tags
Table of Contents
Properties
- $data : array<string|int, mixed>
Methods
- __construct() : mixed
- get() : mixed
- Returns the value of a single field on the document, or `$default` when the field is absent.
- getFrom() : string|null
- Returns the `_from` document identifier (source vertex), or null when not set.
- getId() : string|null
- Returns the ArangoDB document identifier (`_id`), or null when the document has not been persisted yet.
- getKey() : string|null
- Returns the ArangoDB document key (`_key`), or null when the document has not been persisted yet.
- getRev() : string|null
- Returns the document revision (`_rev`) — read-only, managed by the server. Null when the document has not been persisted yet.
- getTo() : string|null
- Returns the `_to` document identifier (target vertex), or null when not set.
- has() : bool
- Returns true when the document has the given field (even when the stored value is null).
- isNew() : bool
- Returns true when the document has not been persisted yet (no `_key` assigned by the server).
- toArray() : array<string, mixed>
- Returns the underlying raw data array (including reserved attributes).
Properties
$data
public
array<string|int, mixed>
$data
= []
Methods
__construct()
public
__construct([array<string, mixed> $data = [] ]) : mixed
Parameters
- $data : array<string, mixed> = []
-
Raw document data as returned by the server (including the reserved
_key/_id/_revattributes when present).
get()
Returns the value of a single field on the document, or `$default` when the field is absent.
public
get(string $field[, mixed $default = null ]) : mixed
Parameters
- $field : string
-
Field name (top-level only).
- $default : mixed = null
-
Fallback value when the field is absent.
getFrom()
Returns the `_from` document identifier (source vertex), or null when not set.
public
getFrom() : string|null
Return values
string|nullgetId()
Returns the ArangoDB document identifier (`_id`), or null when the document has not been persisted yet.
public
getId() : string|null
Return values
string|nullgetKey()
Returns the ArangoDB document key (`_key`), or null when the document has not been persisted yet.
public
getKey() : string|null
Return values
string|nullgetRev()
Returns the document revision (`_rev`) — read-only, managed by the server. Null when the document has not been persisted yet.
public
getRev() : string|null
Return values
string|nullgetTo()
Returns the `_to` document identifier (target vertex), or null when not set.
public
getTo() : string|null
Return values
string|nullhas()
Returns true when the document has the given field (even when the stored value is null).
public
has(string $field) : bool
Parameters
- $field : string
Return values
boolisNew()
Returns true when the document has not been persisted yet (no `_key` assigned by the server).
public
isNew() : bool
Return values
booltoArray()
Returns the underlying raw data array (including reserved attributes).
public
toArray() : array<string, mixed>