mini\Table\Wrappers\ExistsTable class

Documentation

Filters outer table rows based on existence in inner table

Implements WHERE EXISTS / NOT EXISTS semantics with memory-bounded algorithms:

  • Sort-merge when at least one side is indexed on correlation column
  • Block hash when neither side is indexed (processes outer in chunks)
// EXISTS (SELECT 1 FROM t2 WHERE t2.id = t1.id AND t2.cat = 'C5')
$filtered = $innerTable->eq('cat', 'C5');
$result = new ExistsTable($outerTable, $filtered, [['t1.id', 't2.id']], false);

// NOT EXISTS
$result = new ExistsTable($outerTable, $filtered, [['t1.id', 't2.id']], true);

Inheritance

Extends: mini\Table\AbstractTable

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

Properties (7)

private array $correlations
private bool $negated
protected ?Closure $compareFn
protected ?int $limit
protected int $offset

Methods (40)

Documentation missing

Documentation missing

Sort-merge EXISTS: sort both sides and merge to find matches

Sort-merge NOT EXISTS: yield outer rows that have NO match in inner

Block hash EXISTS: process outer in chunks, scan inner for each chunk

Build composite hash key from row values

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Hook for subclasses to customize clone behavior

Get column name(s) that the row key represents

Get the string comparison function for sorting

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Get the current table alias (null if not set)

Documentation missing

Documentation missing

Documentation missing

Documentation missing

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

Get the primary key column definition (cached)

Iterate over rows with visible columns only

Get columns available for output

Get all column definitions regardless of projection

Narrow to specific columns

Load a single row by its row ID

Get a property value

Check if a property exists (including null values)

Return table with property set

Source

src/Table/Wrappers/ExistsTable.php:28-367