mini\Table\ColumnDef::commonWith() Method

public

Signature

public function commonWith(self $other): self

Parameters

Name Type Default Description
$other self required Documentation missing

Returns

self

Documentation

Get the common denominator ColumnDef

Returns a ColumnDef with the same type, weaker index type, and common prefix of indexWith columns. Type parameters must match exactly.

$a = new ColumnDef('id', ColumnType::Int, IndexType::Primary);
$b = new ColumnDef('id', ColumnType::Int, IndexType::Index);
$a->commonWith($b);  // ColumnDef('id', ColumnType::Int, IndexType::Index)

$a = new ColumnDef('a', ColumnType::Int, IndexType::Index, [], 'b', 'c');
$b = new ColumnDef('a', ColumnType::Int, IndexType::Index, [], 'b', 'd');
$a->commonWith($b);  // ColumnDef('a', ColumnType::Int, IndexType::Index, [], 'b')

Source

src/Table/ColumnDef.php:129-169