Oihana PHP Arango

ArangoProfileTrait

Resolves the **named** and **external** dump/restore *profiles*.

A profile is a reusable, named bundle that describes what to extract — and optionally from where (the dump source). It carries:

  • collections / edges — the positive selection (merged into one list) ;
  • exclude — names removed from the resolved set (set subtraction) ;
  • endpoint / database / user / password — an optional source connection, used by the dump action only (the restore always writes to the local target — it borrows the selection, never the connection) ;
  • directory — an optional output directory for the dump action (where its archive is written, unless --directory overrides it on the CLI).

A profile lives either in the [arango.profiles.<name>] section of the project config.toml (referenced by name) or in a standalone .toml file (referenced by path, absolute or relative). Both parse to the same flat array.

Selection rules:

  • a positive list (collections + edges) minus exclude ;
  • an exclude-only profile means "everything minus exclude" — the universe (server collections for dump, archive collections for restore) is supplied by the caller.

Table of Contents

Properties

$profiles  : array<string|int, mixed>
The declared named profiles, from the `[arango.profiles]` config section.

Methods

initializeArangoProfiles()  : static
Captures the `[arango.profiles]` config section from the init array.
profileConnection()  : array<string|int, mixed>
The optional **source** connection carried by a profile (dump only).
profileDirectory()  : string|null
The optional output **directory** carried by a profile (dump only).
profileExclude()  : array<string|int, mixed>
The `exclude` list of a profile.
profilePositive()  : array<string|int, mixed>
The positive selection of a profile — `collections` + `edges` merged.
profileSelection()  : array<string|int, mixed>
The effective collection list of a profile.
resolveProfile()  : array<string|int, mixed>|null
Resolves the `--profile` value to a profile array.
looksLikePath()  : bool
True when a `--profile` value designates an external `.toml` file rather than a named section.
normalizeProfileList()  : array<string|int, mixed>
Flattens a profile list value: arrays and comma-separated strings → a clean, de-duplicated list of trimmed names.

Properties

$profiles

The declared named profiles, from the `[arango.profiles]` config section.

protected array<string|int, mixed> $profiles = []

Methods

initializeArangoProfiles()

Captures the `[arango.profiles]` config section from the init array.

public initializeArangoProfiles([array<string|int, mixed> $init = [] ]) : static
Parameters
$init : array<string|int, mixed> = []
Return values
static

profileConnection()

The optional **source** connection carried by a profile (dump only).

public profileConnection(array<string|int, mixed> $profile) : array<string|int, mixed>
Parameters
$profile : array<string|int, mixed>
Return values
array<string|int, mixed>

The present connection keys among endpoint/database/user/password.

profileDirectory()

The optional output **directory** carried by a profile (dump only).

public profileDirectory(array<string|int, mixed> $profile) : string|null

When set, a dump using this profile writes its archive here unless the --directory CLI flag overrides it. The restore action ignores this key — it always writes to the local target.

Parameters
$profile : array<string|int, mixed>
Return values
string|null

The directory, or null when absent or not a string.

profileExclude()

The `exclude` list of a profile.

public profileExclude(array<string|int, mixed> $profile) : array<string|int, mixed>
Parameters
$profile : array<string|int, mixed>
Return values
array<string|int, mixed>

profilePositive()

The positive selection of a profile — `collections` + `edges` merged.

public profilePositive(array<string|int, mixed> $profile) : array<string|int, mixed>
Parameters
$profile : array<string|int, mixed>
Return values
array<string|int, mixed>

profileSelection()

The effective collection list of a profile.

public profileSelection(array<string|int, mixed> $profile[, array<string|int, mixed> $allCollections = [] ]) : array<string|int, mixed>

A positive selection minus exclude; when the positive list is empty, $allCollections (the universe) minus exclude.

Parameters
$profile : array<string|int, mixed>
$allCollections : array<string|int, mixed> = []

The universe used for an exclude-only profile.

Return values
array<string|int, mixed>

resolveProfile()

Resolves the `--profile` value to a profile array.

public resolveProfile(string|null $profile) : array<string|int, mixed>|null

A path-like value (absolute, containing a separator, or ending in .toml) is loaded as an external file; otherwise it is looked up among the declared named profiles.

Parameters
$profile : string|null
Return values
array<string|int, mixed>|null

Null when no profile is requested.

looksLikePath()

True when a `--profile` value designates an external `.toml` file rather than a named section.

private looksLikePath(string $value) : bool
Parameters
$value : string
Return values
bool

normalizeProfileList()

Flattens a profile list value: arrays and comma-separated strings → a clean, de-duplicated list of trimmed names.

private normalizeProfileList(mixed $raw) : array<string|int, mixed>
Parameters
$raw : mixed
Return values
array<string|int, mixed>
On this page

Search results