GetColumnDeclarationSQLCommentTypeAwareTrait
This trait provides some methods to restore removed behaviour of Doctrine DBAL within the extended {@see AbstractPlatform} hierarchy.
Related code places code has been taken from or adopted for it:
- https://github.com/doctrine/dbal/blob/61446f07fcb522414d6cfd8b1c3e5f9e18c579ba/src/Platforms/AbstractPlatform.php#L555-L572
- https://github.com/doctrine/dbal/blob/61446f07fcb522414d6cfd8b1c3e5f9e18c579ba/src/Platforms/AbstractPlatform.php#L574-L597
- https://github.com/doctrine/dbal/blob/61446f07fcb522414d6cfd8b1c3e5f9e18c579ba/src/Types/Type.php#L275-L295
- https://github.com/doctrine/dbal/blob/61446f07fcb522414d6cfd8b1c3e5f9e18c579ba/src/Types/JsonType.php#L80-L95
Table of Contents
Methods
- getColumnDeclarationSQL() : string
- Note that this provides a method override to combine type based comments with the column comment on platforms.
Methods
getColumnDeclarationSQL()
Note that this provides a method override to combine type based comments with the column comment on platforms.
public
getColumnDeclarationSQL(string $name, array<string|int, mixed> $column) : string
Obtains DBMS specific SQL code portion needed to declare a generic type column to be used in statements like CREATE TABLE.
Parameters
- $name : string
-
The name the column to be declared.
- $column : array<string|int, mixed>
-
An associative array with the name of the properties of the column being declared as array indexes. Currently, the types of supported column properties are as follows:
length Integer value that determines the maximum length of the text column. If this argument is missing the column should be declared to have the longest length allowed by the DBMS. default Text value to be used as default for this column. notnull Boolean flag that indicates whether this column is constrained to not be set to null. charset Text value with the default CHARACTER SET for this column. collation Text value with the default COLLATION for this column. columnDefinition a string that defines the complete column
The method should be only used from within the AbstractPlatform class hierarchy.
Return values
string —DBMS specific SQL code portion that should be used to declare the column.