Oihana PHP Arango

extractFromIDs.php

Table of Contents

Functions

extractFromIDs()  : array<string|int, mixed>
Extract unique "_from" vertex IDs from a list of edge documents.

Functions

extractFromIDs()

Extract unique "_from" vertex IDs from a list of edge documents.

extractFromIDs(array<string|int, mixed> $edges) : array<string|int, mixed>

This helper function is a shortcut for extractVertexIds() with $side fixed to Schema::_FROM. It returns a unique list of vertex IDs from the "_from" field in an array of edge documents (objects or associative arrays).

Parameters
$edges : array<string|int, mixed>

Array of edge objects or associative arrays containing _from and _to.

Tags
example
use oihana\arango\models\helpers\extractFromIds;
use org\schema\constants\Schema;

$edges = [
    (object) ['_from' => 'apis/1', '_to' => 'permissions/1'],
    (object) ['_from' => 'apis/1', '_to' => 'permissions/2'],
    ['_from' => 'apis/2', '_to' => 'permissions/1'],
];

$fromIds = extractFromIds($edges);
// Result: ['apis/1', 'apis/2']
author

Marc Alcaraz (eKameleon)

version
1.0.0
Return values
array<string|int, mixed>

Unique list of "_from" vertex IDs.

On this page

Search results