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
OpenFGA\Models
ModelInterface
JsonSerializable
- BatchTupleOperation (implementation)
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.
Name | Type | Description |
---|---|---|
$chunkSize |
int |
Maximum tuples per chunk (default: API limit) |
array<[
BatchTupleOperationInterface](BatchTupleOperationInterface)>
— Array of operations, each within the chunk size
public function getDeletes(): TupleKeysInterface|null
Get the tuples to delete in this operation.
TupleKeysInterface
| null
— Collection of tuples to delete, or null if none
public function getTotalOperations(): int
Get the total number of operations (writes + deletes).
int
— Total count of tuples to be processed
public function getWrites(): TupleKeysInterface|null
Get the tuples to write in this operation.
TupleKeysInterface
| null
— Collection of tuples to write, or null if none
public function isEmpty(): bool
Check if this operation is empty (no writes or deletes).
bool
— True if no operations are defined
public function jsonSerialize()
public function requiresChunking(int $chunkSize = 100): bool
Check if this operation requires chunking due to size limits.
Name | Type | Description |
---|---|---|
$chunkSize |
int |
Maximum tuples per chunk (default: API limit) |
bool
— True if the operation exceeds the specified chunk size