vertexID.php
Table of Contents
Functions
- vertexID() : string|null
- Resolves a fully-qualified vertex ID for an ArangoDB edge.
Functions
vertexID()
Resolves a fully-qualified vertex ID for an ArangoDB edge.
vertexID(string|null $vertexKey[, Documents|string|null $collection = null ]) : string|null
Converts a vertex key into a complete ArangoDB vertex ID by optionally prefixing it with a collection name.
This is useful when preparing
_from or _to fields in edge queries, ensuring the correct
collection/key format.
Behavior
- If
$vertexKeyisnull, the function returnsnull. - If
$collectionis aDocumentsinstance with acollectionproperty, the returned ID will be prefixed with this collection. - If
$collectionis a string, it will be used directly as the collection prefix. - If
$collectionisnull, the function returns the raw$vertexKey.
Parameters
- $vertexKey : string|null
-
The vertex key (document _key) or null.
- $collection : Documents|string|null = null
-
Optional collection prefix, either a string or a Documents instance.
Tags
Return values
string|null —Returns the prefixed vertex ID if a collection is provided, otherwise the original key, or null if $vertexKey is null.