protected final function Initialize() { $this->Register(Mysql\Columns\CharacterSet::GetType(), [$this, 'AppendCharacterSet']); $this->Register(Mysql\Columns\Collation::GetType(), [$this, 'AppendCollation']); $this->Register(Traits\Comment::GetType(), [$this, 'AppendComment']); $this->Register(Traits\DefaultValue::GetType(), [$this, 'AppendDefaultValue']); $this->Register(Traits\Increment::GetType(), [$this, 'AppendIncrement']); $this->Register(Traits\NotNullable::GetType(), [$this, 'AppendNotNullable']); }
protected function OnSetPrimaryKeyColumns(array $PrimaryKeyColumns) { $Column = reset($PrimaryKeyColumns); if (count($PrimaryKeyColumns) !== 1) { throw new \Storm\Core\UnexpectedValueException('%s only supports single auto increment column: %d given', get_class($this), count($PrimaryKeyColumns)); } else { if (!$Column->HasTrait(Relational\Columns\Traits\Increment::GetType())) { throw new \Storm\Core\Relational\InvalidColumnException('The supplied column %s must contain the %s trait', $Column->GetName(), Relational\Columns\Traits\Increment::GetType()); } } $this->IncrementColumn = $Column; }