Oihana PHP Arango

conditions

Table of Contents

Functions

isAdditionalType()  : array<string|int, mixed>
Filter documents by additionalType schema.
isProperty()  : array<string|int, mixed>
Build an AQL equality condition on a document property.
isSchemaType()  : array<string|int, mixed>
Filter documents by the canonical schema type of a Thing class.

Functions

isAdditionalType()

Filter documents by additionalType schema.

isAdditionalType(string|array<string|int, mixed> $schemaType[, string $docRef = AQL::DOC ]) : array<string|int, mixed>

Accepts a string, an AQL expression, or an array of values.

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

The schema type(s) to filter by

$docRef : string = AQL::DOC

The AQL doc reference (default: doc)

Tags
throws
UnsupportedOperationException
example
isAdditionalType('Person');
// → doc.additionalType == 'Person'

isAdditionalType(['Person','Organization']);
// → doc.additionalType IN ['Person','Organization']

isAdditionalType('@types');
// → doc.additionalType == @types
author

Marc Alcaraz (eKameleon)

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

An array containing a single AQL condition expression

isProperty()

Build an AQL equality condition on a document property.

isProperty(string $property, null|string|array<string|int, mixed> $value[, string $docRef = AQL::DOC ]) : array<string|int, mixed>

This helper creates an equality condition (==) when a scalar value or AQL expression is provided, and an IN condition when an array of values is given.

Parameters
$property : string

The property name (Prop::*)

$value : null|string|array<string|int, mixed>

The expected value or expression.

$docRef : string = AQL::DOC

The AQL doc reference (default: doc)

Tags
example
isProperty('status', 'active');
// → doc.status == 'active'

isProperty('status', ['active', 'pending']);
// → doc.status IN ['active','pending']

isProperty('tags', '@tags');
// → doc.tags == @tags

isProperty('name', 'doc2.name');
// → doc.name == doc2.name

isProperty('table', [1, 'hello', true, '\@_param']);
// → doc.table IN [1,'hello',true,@param]
throws
InvalidArgumentException

If the value is null, empty, or invalid

UnsupportedOperationException

If the value type is unsupported.

author

Marc Alcaraz (eKameleon)

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

An array containing a single AQL condition expression

isSchemaType()

Filter documents by the canonical schema type of a Thing class.

isSchemaType(Thing>|array<string|int, Thing>$class[, string $docRef = AQL::DOC ]) : array<string|int, mixed>

Resolves the absolute type URI of the given class — its CONTEXT plus its short name, see Thing::getSchemaType() — and delegates to isAdditionalType(). Accepts several classes for an IN condition.

Parameters
$class : Thing>|array<string|int, Thing>>

The Thing class(es) to filter by.

$docRef : string = AQL::DOC

The AQL doc reference (default: doc).

Tags
throws
InvalidArgumentException

If a class is not Thing or a Thing subclass.

UnsupportedOperationException

If the resolved value type is unsupported.

example
use xyz\oihana\schema\organizations\Customer;
use xyz\oihana\schema\places\CustomerSite;
use xyz\oihana\schema\places\Warehouse;

isSchemaType( Customer::class ) ;
// → doc.additionalType == 'https://schema.oihana.xyz/Customer'

isSchemaType([ CustomerSite::class , Warehouse::class ]) ;
// → doc.additionalType IN [ '…/CustomerSite' , '…/Warehouse' ]
Return values
array<string|int, mixed>

An array containing a single AQL condition expression.

On this page

Search results