Oihana PHP Arango

Edge extends Document

Read onlyYes

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
author

Marc Alcaraz (ekameleon)

since
1.0.0

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 / _rev attributes 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|null

getId()

Returns the ArangoDB document identifier (`_id`), or null when the document has not been persisted yet.

public getId() : string|null
Return values
string|null

getKey()

Returns the ArangoDB document key (`_key`), or null when the document has not been persisted yet.

public getKey() : string|null
Return values
string|null

getRev()

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|null

getTo()

Returns the `_to` document identifier (target vertex), or null when not set.

public getTo() : string|null
Return values
string|null

has()

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
bool

isNew()

Returns true when the document has not been persisted yet (no `_key` assigned by the server).

public isNew() : bool
Return values
bool

toArray()

Returns the underlying raw data array (including reserved attributes).

public toArray() : array<string, mixed>
Return values
array<string, mixed>
On this page

Search results