com\setasign\SetaFramework\Database\Manager\Column

EnumColumn Class Enum

File: /SetaFramework/src/Database/Manager/Column/EnumColumn.php

Class hierarchy

Uses

Implements

Summary

Constants

DEFAULT_CURRENT_TIMESTAMP

public const AbstractColumn::DEFAULT_CURRENT_TIMESTAMP = 'current_timestamp()'

DEFAULT_NULL

public const AbstractColumn::DEFAULT_NULL = 'NULL'

Properties

$allowNull

protected bool AbstractColumn::$allowNull = false

$collation

protected ?string HasCollationTrait::$collation

$columnName

protected string AbstractColumn::$columnName

$default

protected mixed AbstractColumn::$default

$enumeration

protected string[] EnumColumn::$enumeration

$indexes

protected array AbstractColumn::$indexes = array()

$oldColumnName

protected ?string AbstractColumn::$oldColumnName

Methods

__construct()

public EnumColumn::__construct (
string $columnName,
string[] $enumeration
)

Enum constructor.

Parameters
$columnName : string
 
$enumeration : string[]
 

addIndex()

Parameters
$type : string
 
$indexName : ?string
 

addPrimaryKey()

addUnique()

public AbstractColumn::addUnique (
?string $indexName = null
): $this
Parameters
$indexName : ?string
 

changeDataType()

Change the dataType of a column (with all possible attributes)

Parameters
$newColumnObject : AbstractColumn
 

copy()

This method clones this object, removes the tableSchema and returns the clone.

getCollation()

public HasCollationTrait::getCollation (
void
): ?string

getDefault()

public AbstractColumn::getDefault (
void
): mixed

getEnumeration()

public EnumColumn::getEnumeration (
void
): array

getIndexes()

public AbstractColumn::getIndexes (
void
): array

getName()

public AbstractColumn::getName (
void
): string

getOldColumnName()

public AbstractColumn::getOldColumnName (
void
): ?string

hasChanged()

public EnumColumn::hasChanged (
AbstractColumn $compareColumn,
bool $compareDataType = true,
bool $compareName = true
): bool

Checks whether this column is the same as $compareColumn.

Parameters
$compareColumn : AbstractColumn
 
$compareDataType : bool

Check whether both dataTypes are equal.

$compareName : bool

Check whether both columnNames are equal.

Exceptions

Throws \JsonException

isAllowedNull()

public AbstractColumn::isAllowedNull (
void
): bool

removeAllIndexes()

removeIndex()

public AbstractColumn::removeIndex (
?string $indexName = null
): $this
Parameters
$indexName : ?string
 

rename()

public AbstractColumn::rename (
string $newName
): $this
Parameters
$newName : string
 
Exceptions

Throws \com\setasign\SetaFramework\Exception

setAllowNull()

public AbstractColumn::setAllowNull (
bool $allowNull = true
): $this
Parameters
$allowNull : bool
 

setCollation()

public HasCollationTrait::setCollation (
?string $collation
): $this
Parameters
$collation : ?string
 

setDefault()

public AbstractColumn::setDefault (
null|string|int $default
): $this
Parameters
$default : null|string|int
 

setEnumeration()

public EnumColumn::setEnumeration (
string[] $enumeration
): $this

Change the enumeration list.

Parameters
$enumeration : string[]
 

setOldColumnName()

public AbstractColumn::setOldColumnName (
string $oldColumnName
): $this

Used for TableSchemaBuilder. Will be ignored for hasChanged

Parameters
$oldColumnName : string