class Column extends AbstractAsset (View source)

Object representation of a database column.

Properties

protected string $_name from AbstractAsset
protected string|null $_namespace Namespace of the asset. If none isset the default namespace is assumed. from AbstractAsset
protected bool $_quoted from AbstractAsset
protected Type $_type
protected int|null $_length
protected int $_precision
protected int $_scale
protected bool $_unsigned
protected bool $_fixed
protected bool $_notnull
protected string|null $_default
protected bool $_autoincrement
protected array $_platformOptions
protected string|null $_columnDefinition
protected string|null $_comment
protected array $_customSchemaOptions

Methods

void
_setName(string $name)

Sets the name of this asset.

bool
isInDefaultNamespace(string $defaultNamespaceName)

Is this asset in the default namespace?

string|null
getNamespaceName()

Gets the namespace name of this asset.

string
getShortestName(string $defaultNamespaceName)

The shortest name is stripped of the default namespace. All other namespaced elements are returned as full-qualified names.

string
getFullQualifiedName(string $defaultNamespaceName)

The normalized name is full-qualified and lowerspaced. Lowerspacing is actually wrong, but we have to do it to keep our sanity. If you are using database objects that only differentiate in the casing (FOO vs Foo) then you will NOT be able to use Doctrine Schema abstraction.

bool
isQuoted()

Checks if this asset's name is quoted.

bool
isIdentifierQuoted(string $identifier)

Checks if this identifier is quoted.

string
trimQuotes(string $identifier)

Trim quotes from the identifier.

string
getName()

Returns the name of this schema asset.

string
getQuotedName(AbstractPlatform $platform)

Gets the quoted representation of this asset but only if it was defined with one. Otherwise return the plain unquoted value as inserted.

string
_generateIdentifierName(array $columnNames, string $prefix = '', int $maxSize = 30)

Generates an identifier from a list of column names obeying a certain string length.

__construct(string $columnName, Type $type, array $options = [])

Creates a new Column.

setOptions(array $options)

No description

setType(Type $type)

No description

setLength(int|null $length)

No description

setPrecision(int $precision)

No description

setScale(int $scale)

No description

setUnsigned(bool $unsigned)

No description

setFixed(bool $fixed)

No description

setNotnull(bool $notnull)

No description

setDefault(mixed $default)

No description

setPlatformOptions(array $platformOptions)

No description

setPlatformOption(string $name, mixed $value)

No description

setColumnDefinition(string $value)

No description

getType()

No description

int|null
getLength()

No description

int
getPrecision()

No description

int
getScale()

No description

bool
getUnsigned()

No description

bool
getFixed()

No description

bool
getNotnull()

No description

string|null
getDefault()

No description

array
getPlatformOptions()

No description

bool
hasPlatformOption(string $name)

No description

mixed
getPlatformOption(string $name)

No description

string|null
getColumnDefinition()

No description

bool
getAutoincrement()

No description

setAutoincrement(bool $flag)

No description

setComment(string $comment)

No description

string|null
getComment()

No description

setCustomSchemaOption(string $name, mixed $value)

No description

bool
hasCustomSchemaOption(string $name)

No description

mixed
getCustomSchemaOption(string $name)

No description

setCustomSchemaOptions(array $customSchemaOptions)

No description

array
getCustomSchemaOptions()

No description

array
toArray()

No description

Details

protected void _setName(string $name)

Sets the name of this asset.

Parameters

string $name

Return Value

void

bool isInDefaultNamespace(string $defaultNamespaceName)

Is this asset in the default namespace?

Parameters

string $defaultNamespaceName

Return Value

bool

string|null getNamespaceName()

Gets the namespace name of this asset.

If NULL is returned this means the default namespace is used.

Return Value

string|null

string getShortestName(string $defaultNamespaceName)

The shortest name is stripped of the default namespace. All other namespaced elements are returned as full-qualified names.

Parameters

string $defaultNamespaceName

Return Value

string

string getFullQualifiedName(string $defaultNamespaceName)

The normalized name is full-qualified and lowerspaced. Lowerspacing is actually wrong, but we have to do it to keep our sanity. If you are using database objects that only differentiate in the casing (FOO vs Foo) then you will NOT be able to use Doctrine Schema abstraction.

Every non-namespaced element is prefixed with the default namespace name which is passed as argument to this method.

Parameters

string $defaultNamespaceName

Return Value

string

bool isQuoted()

Checks if this asset's name is quoted.

Return Value

bool

protected bool isIdentifierQuoted(string $identifier)

Checks if this identifier is quoted.

Parameters

string $identifier

Return Value

bool

protected string trimQuotes(string $identifier)

Trim quotes from the identifier.

Parameters

string $identifier

Return Value

string

string getName()

Returns the name of this schema asset.

Return Value

string

string getQuotedName(AbstractPlatform $platform)

Gets the quoted representation of this asset but only if it was defined with one. Otherwise return the plain unquoted value as inserted.

Parameters

AbstractPlatform $platform

Return Value

string

protected string _generateIdentifierName(array $columnNames, string $prefix = '', int $maxSize = 30)

Generates an identifier from a list of column names obeying a certain string length.

This is especially important for Oracle, since it does not allow identifiers larger than 30 chars, however building idents automatically for foreign keys, composite keys or such can easily create very long names.

Parameters

array $columnNames
string $prefix
int $maxSize

Return Value

string

__construct(string $columnName, Type $type, array $options = [])

Creates a new Column.

Parameters

string $columnName
Type $type
array $options

Column setOptions(array $options)

Parameters

array $options

Return Value

Column

Column setType(Type $type)

Parameters

Type $type

Return Value

Column

Column setLength(int|null $length)

Parameters

int|null $length

Return Value

Column

Column setPrecision(int $precision)

Parameters

int $precision

Return Value

Column

Column setScale(int $scale)

Parameters

int $scale

Return Value

Column

Column setUnsigned(bool $unsigned)

Parameters

bool $unsigned

Return Value

Column

Column setFixed(bool $fixed)

Parameters

bool $fixed

Return Value

Column

Column setNotnull(bool $notnull)

Parameters

bool $notnull

Return Value

Column

Column setDefault(mixed $default)

Parameters

mixed $default

Return Value

Column

Column setPlatformOptions(array $platformOptions)

Parameters

array $platformOptions

Return Value

Column

Column setPlatformOption(string $name, mixed $value)

Parameters

string $name
mixed $value

Return Value

Column

Column setColumnDefinition(string $value)

Parameters

string $value

Return Value

Column

Type getType()

Return Value

Type

int|null getLength()

Return Value

int|null

int getPrecision()

Return Value

int

int getScale()

Return Value

int

bool getUnsigned()

Return Value

bool

bool getFixed()

Return Value

bool

bool getNotnull()

Return Value

bool

string|null getDefault()

Return Value

string|null

array getPlatformOptions()

Return Value

array

bool hasPlatformOption(string $name)

Parameters

string $name

Return Value

bool

mixed getPlatformOption(string $name)

Parameters

string $name

Return Value

mixed

string|null getColumnDefinition()

Return Value

string|null

bool getAutoincrement()

Return Value

bool

Column setAutoincrement(bool $flag)

Parameters

bool $flag

Return Value

Column

Column setComment(string $comment)

Parameters

string $comment

Return Value

Column

string|null getComment()

Return Value

string|null

Column setCustomSchemaOption(string $name, mixed $value)

Parameters

string $name
mixed $value

Return Value

Column

bool hasCustomSchemaOption(string $name)

Parameters

string $name

Return Value

bool

mixed getCustomSchemaOption(string $name)

Parameters

string $name

Return Value

mixed

Column setCustomSchemaOptions(array $customSchemaOptions)

Parameters

array $customSchemaOptions

Return Value

Column

array getCustomSchemaOptions()

Return Value

array

array toArray()

Return Value

array