mini\Table\GeneratorTable class

Documentation

Simple table backed by a generator/closure

The closure must return a generator that yields key => stdClass pairs. Column definitions must be provided explicitly.

$table = new GeneratorTable(
    function() {
        yield 1 => (object)['id' => 1, 'name' => 'Alice'];
        yield 2 => (object)['id' => 2, 'name' => 'Bob'];
    },
    new ColumnDef('id', ColumnType::Int, IndexType::Primary),
    new ColumnDef('name', ColumnType::Text),
);

Small result sets (≤1000 rows) are cached after first iteration for efficient repeated access. Larger result sets stream without buffering.

Inheritance

Extends: mini\Table\AbstractTable

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

Properties (4)

private Closure $generator
protected ?Closure $compareFn
protected ?int $limit
protected int $offset

Methods (35)

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

public __clone()
inherited from mini\Table\AbstractTable

Hook for subclasses to customize clone behavior

public getRowKeyColumns()
inherited from mini\Table\AbstractTable

Get column name(s) that the row key represents

protected getCompareFn()
inherited from mini\Table\AbstractTable

Get the string comparison function for sorting

public limit()
inherited from mini\Table\AbstractTable

Documentation missing

public offset()
inherited from mini\Table\AbstractTable

Documentation missing

public getLimit()
inherited from mini\Table\AbstractTable

Documentation missing

public getOffset()
inherited from mini\Table\AbstractTable

Documentation missing

public withAlias()
inherited from mini\Table\AbstractTable

Documentation missing

public getTableAlias()
inherited from mini\Table\AbstractTable

Get the current table alias (null if not set)

public union()
inherited from mini\Table\AbstractTable

Documentation missing

public except()
inherited from mini\Table\AbstractTable

Documentation missing

public distinct()
inherited from mini\Table\AbstractTable

Documentation missing

public exists()
inherited from mini\Table\AbstractTable

Documentation missing

public has()
inherited from mini\Table\AbstractTable

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

protected getPrimaryKeyColumn()
inherited from mini\Table\AbstractTable

Get the primary key column definition (cached)

public final getIterator()
inherited from mini\Table\AbstractTable

Iterate over rows with visible columns only

public getColumns()
inherited from mini\Table\AbstractTable

Get columns available for output

public getAllColumns()
inherited from mini\Table\AbstractTable

Get all column definitions regardless of projection

public columns()
inherited from mini\Table\AbstractTable

Narrow to specific columns

public load()
inherited from mini\Table\AbstractTable

Load a single row by its row ID

public getProperty()
inherited from mini\Table\AbstractTable

Get a property value

public hasProperty()
inherited from mini\Table\AbstractTable

Check if a property exists (including null values)

public withProperty()
inherited from mini\Table\AbstractTable

Return table with property set

Source

src/Table/GeneratorTable.php:36-149