mini\Table\Contracts\TableInterface abstract interface

Documentation

Interface for tabular data access with filtering, ordering, and pagination

Implementations MUST be immutable - each method returns a new instance with the constraint applied, leaving the original unchanged:

$all = $table;
$active = $table->eq('status', 'active');  // $all unchanged
$sorted = $active->order('name');           // $active unchanged

This enables safe composition and reuse of filtered views.

Iteration MUST yield row ID as key and row data as stdClass:

foreach ($table as $rowId => $row) {
    // $rowId: int|string unique identifier
    // $row: stdClass with column properties
    echo $row->name;
}

Using stdClass (not array) ensures column names are always explicit, which is required for SetInterface::has() with composite keys.

Row IDs are required for UPDATE/DELETE operations and for deduplication when merging results (e.g., OR clauses via union()).

TableInterface extends SetInterface, enabling tables to be used as subqueries in IN clauses:

$activeUserIds = $users->eq('status', 'active')->columns('id');
$orders->in('user_id', $activeUserIds);

Inheritance

Implements: mini\Table\Contracts\SetInterface IteratorAggregate Countable Traversable

Methods (28)

Get column definitions for this table (SetInterface method)

Get all column definitions regardless of projection

Filter rows where column equals value (NULL uses IS NULL semantics)

Filter rows where column is less than value

Filter rows where column is less than or equal to value

Filter rows where column is greater than value

Filter rows where column is greater than or equal to value

Filter rows where column value is in the given set

Filter rows where column matches a LIKE pattern

Return rows that are in this table OR the other table (set union)

Filter rows matching any of the given predicates (OR semantics)

Return rows that are in this table but NOT in the other set (set difference)

Project to specific columns

Check if value(s) exist in the table's projected columns (SetInterface method)

Set ordering (overwrites previous)

Set maximum number of rows to return (overwrites previous)

Set number of rows to skip (overwrites previous)

Get current limit (null if unlimited)

Get current offset (0 if not set)

Check if the table has any rows

Load a single row by its row ID

Return table with duplicate rows removed

Return table with aliased column names

Get a table property

Check if a property exists (including null values)

Return table with property set

Documentation missing

Documentation missing

Source

src/Table/Contracts/TableInterface.php:50-373