Properties

$_processed

$_processed : boolean

Flag that signals if this batch was processed or not. Processed => true ,or not processed => false

Type

boolean

$_batchParts

$_batchParts : array

The array of BatchPart objects

Type

array

$_nextBatchPartId

$_nextBatchPartId : array

The array of BatchPart objects

Type

array

$_batchPartCursorOptions

$_batchPartCursorOptions : array

An array of BatchPartCursor options

Type

array

$_sanitize

$_sanitize : object

The sanitize default value

Type

object

Methods

__construct()

__construct(\triagens\ArangoDb\Connection $connection, array $options) : \triagens\ArangoDb\Batch

Constructor for Batch instance. Batch instance by default starts capturing request after initiated.

To disable this, pass startCapture=>false inside the options array parameter

Parameters

\triagens\ArangoDb\Connection $connection

that this batch class will monitor for requests in order to batch them. Connection parameter is mandatory.

array $options

An array of options for Batch construction. See below for options:

Options are :

  • '_sanitize' - True to remove _id and _rev attributes from result documents returned from this batch. Defaults to false.
  • '$startCapture' - Start batch capturing immediately after batch instantiation. Defaults to true.
  • Returns

    \triagens\ArangoDb\Batch

    startCapture()

    startCapture(array $options) : \triagens\ArangoDb\Batch

    Start capturing requests. To stop capturing, use stopCapture()

    see triagens\ArangoDb\Batch::stopCapture()

    Parameters

    array $options

    Returns

    \triagens\ArangoDb\Batch

    stopCapture()

    stopCapture() : \triagens\ArangoDb\Batch

    Stop capturing requests. If the batch has not been processed yet, more requests can be appended by calling startCapture() again.

    see Batch::startCapture()

    Throws

    \triagens\ArangoDb\ClientException

    Returns

    \triagens\ArangoDb\Batch

    isActive()

    isActive() : boolean

    Returns true, if this batch is active in its associated connection.

    Returns

    boolean

    isCapturing()

    isCapturing() : boolean

    Returns true, if this batch is capturing requests.

    Returns

    boolean

    activate()

    activate() : object

    Activates the batch. This sets the batch active in its associated connection and also starts capturing.

    Returns

    object —

    $this

    setActive()

    setActive() : object

    Sets the batch active in its associated connection.

    Returns

    object —

    $this

    setCapture()

    setCapture(boolean $state) : object

    Sets the batch's associated connection into capture mode.

    Parameters

    boolean $state

    Returns

    object —

    $this

    getActive()

    getActive(\triagens\ArangoDb\Connection $connection) : $this

    Gets active batch in given connection.

    Parameters

    \triagens\ArangoDb\Connection $connection

    Returns

    $this

    getConnectionCaptureMode()

    getConnectionCaptureMode(\triagens\ArangoDb\Connection $connection) : boolean

    Returns true, if given connection is in batch-capture mode.

    Parameters

    \triagens\ArangoDb\Connection $connection

    Returns

    boolean

    nextBatchPartId()

    nextBatchPartId(mixed $batchPartId) : \triagens\ArangoDb\Batch

    Sets the id of the next batch-part. The id can later be used to retrieve the batch-part.

    Parameters

    mixed $batchPartId

    Returns

    \triagens\ArangoDb\Batch

    nextBatchPartCursorOptions()

    nextBatchPartCursorOptions(mixed $batchPartCursorOptions) : \triagens\ArangoDb\Batch

    Set client side cursor options (for example: sanitize) for the next batch part.

    Parameters

    mixed $batchPartCursorOptions

    Returns

    \triagens\ArangoDb\Batch

    append()

    append(mixed $method, mixed $request) : \triagens\ArangoDb\HttpResponse

    Append the request to the batch-part

    Parameters

    mixed $method
    • The method of the request (GET, POST...)
    mixed $request
    • The request that will get appended to the batch

    Returns

    \triagens\ArangoDb\HttpResponse

    splitWithContentIdKey()

    splitWithContentIdKey(mixed $pattern, mixed $string) : array

    Split batch request and use ContentId as array key

    Parameters

    mixed $pattern
    mixed $string

    Returns

    array —

    $array - Array of batch-parts

    process()

    process() : boolean

    Processes this batch. This sends the captured requests to the server as one batch.

    Throws

    \triagens\ArangoDb\ClientException

    Returns

    boolean —
    • true if processing of the batch was or the HttpResponse object in case of a failure. A successful process just means that tha parts were processed. Each part has it's own response though and should be checked on its own.

    countParts()

    countParts() : integer

    Get the total count of the batch parts

    Returns

    integer —

    $count

    getPart()

    getPart(mixed $partId) : mixed

    Get the batch part identified by the array key (0.

    ..n) or its id (if it was set with nextBatchPartId($id) )

    Parameters

    mixed $partId

    the batch part id. Either it's numeric key or a given name.

    Throws

    \triagens\ArangoDb\ClientException

    Returns

    mixed —

    $batchPart

    getPartResponse()

    getPartResponse(mixed $partId) : mixed

    Get the batch part identified by the array key (0.

    ..n) or its id (if it was set with nextBatchPartId($id) )

    Parameters

    mixed $partId

    the batch part id. Either it's numeric key or a given name.

    Returns

    mixed —

    $partId

    getProcessedPartResponse()

    getProcessedPartResponse(mixed $partId) : mixed

    Get the batch part identified by the array key (0.

    ..n) or its id (if it was set with nextBatchPartId($id) )

    Parameters

    mixed $partId

    the batch part id. Either it's numeric key or a given name.

    Returns

    mixed —

    $partId

    getBatchParts()

    getBatchParts() : array

    Returns the array of batch-parts

    Returns

    array —

    $_batchParts

    setBatchRequest()

    setBatchRequest(boolean $state) : $this

    Sets connection into Batch-Request mode. This is necessary to distinguish between normal and the batch request.

    Parameters

    boolean $state

    Returns

    $this

    getCursorOptions()

    getCursorOptions() : array

    Return an array of cursor options

    Returns

    array —
    • array of options