API Models BatchTupleOperationInterface - evansims/openfga-php GitHub Wiki

Interface for batch tuple operations. Defines the contract for organizing tuple writes and deletes into batches that can be processed efficiently while respecting API limitations.

Table of Contents


Namespace

OpenFGA\Models


Source

View source code


Implements


Related Classes


Methods

chunk

public function chunk(int $chunkSize = 100): array<BatchTupleOperationInterface>

Split this operation into smaller chunks that respect API limits. If the operation doesn't require chunking, returns an array containing only this operation. Otherwise, splits the writes and deletes across multiple operations to stay within the specified chunk size.

View source


Parameters

Name Type Description
$chunkSize int Maximum tuples per chunk (default: API limit)

Returns

array&lt;[BatchTupleOperationInterface](BatchTupleOperationInterface)&gt; — Array of operations, each within the chunk size


getDeletes

public function getDeletes(): TupleKeysInterface|null

Get the tuples to delete in this operation.

View source


Returns

TupleKeysInterface | null — Collection of tuples to delete, or null if none


getTotalOperations

public function getTotalOperations(): int

Get the total number of operations (writes + deletes).

View source


Returns

int — Total count of tuples to be processed


getWrites

public function getWrites(): TupleKeysInterface|null

Get the tuples to write in this operation.

View source


Returns

TupleKeysInterface | null — Collection of tuples to write, or null if none


isEmpty

public function isEmpty(): bool

Check if this operation is empty (no writes or deletes).

View source


Returns

bool — True if no operations are defined


jsonSerialize

public function jsonSerialize()

requiresChunking

public function requiresChunking(int $chunkSize = 100): bool

Check if this operation requires chunking due to size limits.

View source


Parameters

Name Type Description
$chunkSize int Maximum tuples per chunk (default: API limit)

Returns

bool — True if the operation exceeds the specified chunk size

⚠️ **GitHub.com Fallback** ⚠️