Oihana PHP Arango

DocumentsRepsertTrait uses trait:short

Table of Contents

Methods

buildUpsertQuery()  : string
Build the AQL query for an upsert clause (upsert or repsert modes).
repsert()  : array<string, mixed>|object|null
Repsert a document into the collection (replace or insert).

Methods

buildUpsertQuery()

Build the AQL query for an upsert clause (upsert or repsert modes).

public buildUpsertQuery("update"|"replace" $mode[, array<string|int, mixed> $init = [] ][, array<string|int, mixed> &$bindVars = [] ]) : string
Parameters
$mode : "update"|"replace"

Operation mode: 'update' for upsert, 'replace' for repsert.

$init : array<string|int, mixed> = []

The initialization array with optional settings:

  • value (mixed) : The value to search for.
  • key (?string) : The attribute key to target (default "_key").
  • prefix (?string) : Document prefix (default "doc").
  • binds : Bind variables array.
  • conditions : Extra conditions for the AQL FILTER.
  • extraQuery : Extra AQL snippets to inject in the FILTER.
  • active : Optional active flag.
  • fields (?array) : Specific fields to return.
  • skin (?string) : Skin to apply on the result document.
$bindVars : array<string|int, mixed> = []

The bind variables reference.

Tags
throws
BindException
DateInvalidTimeZoneException
DateMalformedStringException
ReflectionException

If a reflection error occurs (e.g., during internal AQL building).

UnsupportedOperationException
Return values
string

The AQL query expression.

repsert()

Repsert a document into the collection (replace or insert).

public repsert([array<string, mixed> $init = [] ]) : array<string, mixed>|object|null
Parameters
$init : array<string, mixed> = []

The optional parameters to passed-in the function.

Detail of the options :

  • binds : The binding variables to use in the aql connector.
  • collection : The name of the collection or use the collection property of the model.
  • filter : The alternative filterExpression, this syntax for UPSERT operations allows you to use more flexible filter conditions beyond equality matches to look up documents.
  • search : The 'searchExpression' contains the document to be looked for. It must be an object literal (UPSERT { : , ... } ...) without dynamic attribute names. In case no such document can be found in collection, a new document is inserted into the collection as specified in the insertExpression.
  • insert : The document to insert in the collection if the document not exist.
  • replace : The document to replace in the collection.
  • overwrite : The overwriting mode "REPLACE" or "UPDATE" (default)
  • options : The optional upsert options definition array or object.
Tags
throws
ArangoException
BindException
ContainerExceptionInterface
DateInvalidTimeZoneException
DateMalformedStringException
DependencyException
NotFoundException
NotFoundExceptionInterface
ReflectionException
UnsupportedOperationException
Return values
array<string, mixed>|object|null
On this page

Search results