Replace $field, $columnDef and other names with $column across the codebaase

parent 9ea5574e
......@@ -179,7 +179,7 @@ class MysqliStatement implements IteratorAggregate, Statement
// Bind row values _after_ storing the result. Otherwise, if mysqli is compiled with libmysql,
// it will have to allocate as much memory as it may be needed for the given column type
// (e.g. for a LONGBLOB field it's 4 gigabytes)
// (e.g. for a LONGBLOB column it's 4 gigabytes)
// @link https://bugs.php.net/bug.php?id=51386#1270673122
//
// Make sure that the values are bound after each execution. Otherwise, if closeCursor() has been
......
......@@ -179,47 +179,47 @@ abstract class AbstractPlatform
/**
* Returns the SQL snippet that declares a boolean column.
*
* @param mixed[] $columnDef
* @param mixed[] $column
*
* @return string
*/
abstract public function getBooleanTypeDeclarationSQL(array $columnDef);
abstract public function getBooleanTypeDeclarationSQL(array $column);
/**
* Returns the SQL snippet that declares a 4 byte integer column.
*
* @param mixed[] $columnDef
* @param mixed[] $column
*
* @return string
*/
abstract public function getIntegerTypeDeclarationSQL(array $columnDef);
abstract public function getIntegerTypeDeclarationSQL(array $column);
/**
* Returns the SQL snippet that declares an 8 byte integer column.
*
* @param mixed[] $columnDef
* @param mixed[] $column
*
* @return string
*/
abstract public function getBigIntTypeDeclarationSQL(array $columnDef);
abstract public function getBigIntTypeDeclarationSQL(array $column);
/**
* Returns the SQL snippet that declares a 2 byte integer column.
*
* @param mixed[] $columnDef
* @param mixed[] $column
*
* @return string
*/
abstract public function getSmallIntTypeDeclarationSQL(array $columnDef);
abstract public function getSmallIntTypeDeclarationSQL(array $column);
/**
* Returns the SQL snippet that declares common properties of an integer column.
*
* @param mixed[] $columnDef
* @param mixed[] $column
*
* @return string
*/
abstract protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef);
abstract protected function _getCommonIntegerTypeDeclarationSQL(array $column);
/**
* Lazy load Doctrine Type Mappings.
......@@ -248,92 +248,92 @@ abstract class AbstractPlatform
/**
* Returns the SQL snippet used to declare a VARCHAR column type.
*
* @param mixed[] $field
* @param mixed[] $column
*
* @return string
*/
public function getVarcharTypeDeclarationSQL(array $field)
public function getVarcharTypeDeclarationSQL(array $column)
{
if (! isset($field['length'])) {
$field['length'] = $this->getVarcharDefaultLength();
if (! isset($column['length'])) {
$column['length'] = $this->getVarcharDefaultLength();
}
$fixed = $field['fixed'] ?? false;
$fixed = $column['fixed'] ?? false;
$maxLength = $fixed
? $this->getCharMaxLength()
: $this->getVarcharMaxLength();
if ($field['length'] > $maxLength) {
return $this->getClobTypeDeclarationSQL($field);
if ($column['length'] > $maxLength) {
return $this->getClobTypeDeclarationSQL($column);
}
return $this->getVarcharTypeDeclarationSQLSnippet($field['length'], $fixed);
return $this->getVarcharTypeDeclarationSQLSnippet($column['length'], $fixed);
}
/**
* Returns the SQL snippet used to declare a BINARY/VARBINARY column type.
*
* @param mixed[] $field The column definition.
* @param mixed[] $column The column definition.
*
* @return string
*/
public function getBinaryTypeDeclarationSQL(array $field)
public function getBinaryTypeDeclarationSQL(array $column)
{
if (! isset($field['length'])) {
$field['length'] = $this->getBinaryDefaultLength();
if (! isset($column['length'])) {
$column['length'] = $this->getBinaryDefaultLength();
}
$fixed = $field['fixed'] ?? false;
$fixed = $column['fixed'] ?? false;
$maxLength = $this->getBinaryMaxLength();
if ($field['length'] > $maxLength) {
if ($column['length'] > $maxLength) {
if ($maxLength > 0) {
@trigger_error(sprintf(
'Binary field length %d is greater than supported by the platform (%d). Reduce the field length or use a BLOB field instead.',
$field['length'],
'Binary column length %d is greater than supported by the platform (%d). Reduce the column length or use a BLOB column instead.',
$column['length'],
$maxLength
), E_USER_DEPRECATED);
}
return $this->getBlobTypeDeclarationSQL($field);
return $this->getBlobTypeDeclarationSQL($column);
}
return $this->getBinaryTypeDeclarationSQLSnippet($field['length'], $fixed);
return $this->getBinaryTypeDeclarationSQLSnippet($column['length'], $fixed);
}
/**
* Returns the SQL snippet to declare a GUID/UUID field.
* Returns the SQL snippet to declare a GUID/UUID column.
*
* By default this maps directly to a CHAR(36) and only maps to more
* special datatypes when the underlying databases support this datatype.
*
* @param mixed[] $field
* @param mixed[] $column
*
* @return string
*/
public function getGuidTypeDeclarationSQL(array $field)
public function getGuidTypeDeclarationSQL(array $column)
{
$field['length'] = 36;
$field['fixed'] = true;
$column['length'] = 36;
$column['fixed'] = true;
return $this->getVarcharTypeDeclarationSQL($field);
return $this->getVarcharTypeDeclarationSQL($column);
}
/**
* Returns the SQL snippet to declare a JSON field.
* Returns the SQL snippet to declare a JSON column.
*
* By default this maps directly to a CLOB and only maps to more
* special datatypes when the underlying databases support this datatype.
*
* @param mixed[] $field
* @param mixed[] $column
*
* @return string
*/
public function getJsonTypeDeclarationSQL(array $field)
public function getJsonTypeDeclarationSQL(array $column)
{
return $this->getClobTypeDeclarationSQL($field);
return $this->getClobTypeDeclarationSQL($column);
}
/**
......@@ -367,20 +367,20 @@ abstract class AbstractPlatform
/**
* Returns the SQL snippet used to declare a CLOB column type.
*
* @param mixed[] $field
* @param mixed[] $column
*
* @return string
*/
abstract public function getClobTypeDeclarationSQL(array $field);
abstract public function getClobTypeDeclarationSQL(array $column);
/**
* Returns the SQL Snippet used to declare a BLOB column type.
*
* @param mixed[] $field
* @param mixed[] $column
*
* @return string
*/
abstract public function getBlobTypeDeclarationSQL(array $field);
abstract public function getBlobTypeDeclarationSQL(array $column);
/**
* Gets the name of the platform.
......@@ -574,7 +574,7 @@ abstract class AbstractPlatform
}
/**
* Gets the maximum length of a char field.
* Gets the maximum length of a char column.
*/
public function getCharMaxLength(): int
{
......@@ -582,7 +582,7 @@ abstract class AbstractPlatform
}
/**
* Gets the maximum length of a varchar field.
* Gets the maximum length of a varchar column.
*
* @return int
*/
......@@ -592,7 +592,7 @@ abstract class AbstractPlatform
}
/**
* Gets the default length of a varchar field.
* Gets the default length of a varchar column.
*
* @return int
*/
......@@ -602,7 +602,7 @@ abstract class AbstractPlatform
}
/**
* Gets the maximum length of a binary field.
* Gets the maximum length of a binary column.
*
* @return int
*/
......@@ -612,7 +612,7 @@ abstract class AbstractPlatform
}
/**
* Gets the default length of a binary field.
* Gets the default length of a binary column.
*
* @return int
*/
......@@ -722,7 +722,7 @@ abstract class AbstractPlatform
// scalar functions
/**
* Returns the SQL snippet to get the md5 sum of a field.
* Returns the SQL snippet to get the md5 sum of a column.
*
* Note: Not SQL92, but common functionality.
*
......@@ -736,7 +736,7 @@ abstract class AbstractPlatform
}
/**
* Returns the SQL snippet to get the length of a text field.
* Returns the SQL snippet to get the length of a text column.
*
* @param string $column
*
......@@ -760,7 +760,7 @@ abstract class AbstractPlatform
}
/**
* Returns the SQL snippet to round a numeric field to the number of decimals specified.
* Returns the SQL snippet to round a numeric column to the number of decimals specified.
*
* @param string $column
* @param int $decimals
......@@ -2175,69 +2175,69 @@ abstract class AbstractPlatform
}
/**
* Gets declaration of a number of fields in bulk.
* Gets declaration of a number of columns in bulk.
*
* @param mixed[][] $fields A multidimensional associative array.
* The first dimension determines the field name, while the second
* @param mixed[][] $columns A multidimensional associative array.
* The first dimension determines the column name, while the second
* dimension is keyed with the name of the properties
* of the field being declared as array indexes. Currently, the types
* of supported field properties are as follows:
* 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
* field. If this argument is missing the field should be
* 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 field.
* Text value to be used as default for this column.
*
* notnull
* Boolean flag that indicates whether this field is constrained
* 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 field.
* Text value with the default CHARACTER SET for this column.
* collation
* Text value with the default COLLATION for this field.
* Text value with the default COLLATION for this column.
* unique
* unique constraint
*
* @return string
*/
public function getColumnDeclarationListSQL(array $fields)
public function getColumnDeclarationListSQL(array $columns)
{
$queryFields = [];
$declarations = [];
foreach ($fields as $fieldName => $field) {
$queryFields[] = $this->getColumnDeclarationSQL($fieldName, $field);
foreach ($columns as $name => $column) {
$declarations[] = $this->getColumnDeclarationSQL($name, $column);
}
return implode(', ', $queryFields);
return implode(', ', $declarations);
}
/**
* Obtains DBMS specific SQL code portion needed to declare a generic type
* field to be used in statements like CREATE TABLE.
* column to be used in statements like CREATE TABLE.
*
* @param string $name The name the field to be declared.
* @param mixed[] $field An associative array with the name of the properties
* of the field being declared as array indexes. Currently, the types
* of supported field properties are as follows:
* @param string $name The name the column to be declared.
* @param mixed[] $column 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
* field. If this argument is missing the field should be
* 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 field.
* Text value to be used as default for this column.
*
* notnull
* Boolean flag that indicates whether this field is constrained
* 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 field.
* Text value with the default CHARACTER SET for this column.
* collation
* Text value with the default COLLATION for this field.
* Text value with the default COLLATION for this column.
* unique
* unique constraint
* check
......@@ -2247,76 +2247,76 @@ abstract class AbstractPlatform
*
* @return string DBMS specific SQL code portion that should be used to declare the column.
*/
public function getColumnDeclarationSQL($name, array $field)
public function getColumnDeclarationSQL($name, array $column)
{
if (isset($field['columnDefinition'])) {
$columnDef = $this->getCustomTypeDeclarationSQL($field);
if (isset($column['columnDefinition'])) {
$declaration = $this->getCustomTypeDeclarationSQL($column);
} else {
$default = $this->getDefaultValueDeclarationSQL($field);
$default = $this->getDefaultValueDeclarationSQL($column);
$charset = isset($field['charset']) && $field['charset'] ?
' ' . $this->getColumnCharsetDeclarationSQL($field['charset']) : '';
$charset = isset($column['charset']) && $column['charset'] ?
' ' . $this->getColumnCharsetDeclarationSQL($column['charset']) : '';
$collation = isset($field['collation']) && $field['collation'] ?
' ' . $this->getColumnCollationDeclarationSQL($field['collation']) : '';
$collation = isset($column['collation']) && $column['collation'] ?
' ' . $this->getColumnCollationDeclarationSQL($column['collation']) : '';
$notnull = isset($field['notnull']) && $field['notnull'] ? ' NOT NULL' : '';
$notnull = isset($column['notnull']) && $column['notnull'] ? ' NOT NULL' : '';
$unique = isset($field['unique']) && $field['unique'] ?
$unique = isset($column['unique']) && $column['unique'] ?
' ' . $this->getUniqueFieldDeclarationSQL() : '';
$check = isset($field['check']) && $field['check'] ?
' ' . $field['check'] : '';
$check = isset($column['check']) && $column['check'] ?
' ' . $column['check'] : '';
$typeDecl = $field['type']->getSQLDeclaration($field, $this);
$columnDef = $typeDecl . $charset . $default . $notnull . $unique . $check . $collation;
$typeDecl = $column['type']->getSQLDeclaration($column, $this);
$declaration = $typeDecl . $charset . $default . $notnull . $unique . $check . $collation;
if ($this->supportsInlineColumnComments() && isset($field['comment']) && $field['comment'] !== '') {
$columnDef .= ' ' . $this->getInlineColumnCommentSQL($field['comment']);
if ($this->supportsInlineColumnComments() && isset($column['comment']) && $column['comment'] !== '') {
$declaration .= ' ' . $this->getInlineColumnCommentSQL($column['comment']);
}
}
return $name . ' ' . $columnDef;
return $name . ' ' . $declaration;
}
/**
* Returns the SQL snippet that declares a floating point column of arbitrary precision.
*
* @param mixed[] $columnDef
* @param mixed[] $column
*
* @return string
*/
public function getDecimalTypeDeclarationSQL(array $columnDef)
public function getDecimalTypeDeclarationSQL(array $column)
{
$columnDef['precision'] = ! isset($columnDef['precision']) || empty($columnDef['precision'])
? 10 : $columnDef['precision'];
$columnDef['scale'] = ! isset($columnDef['scale']) || empty($columnDef['scale'])
? 0 : $columnDef['scale'];
$column['precision'] = ! isset($column['precision']) || empty($column['precision'])
? 10 : $column['precision'];
$column['scale'] = ! isset($column['scale']) || empty($column['scale'])
? 0 : $column['scale'];
return 'NUMERIC(' . $columnDef['precision'] . ', ' . $columnDef['scale'] . ')';
return 'NUMERIC(' . $column['precision'] . ', ' . $column['scale'] . ')';
}
/**
* Obtains DBMS specific SQL code portion needed to set a default value
* declaration to be used in statements like CREATE TABLE.
*
* @param mixed[] $field The field definition array.
* @param mixed[] $column The column definition array.
*
* @return string DBMS specific SQL code portion needed to set a default value.
*/
public function getDefaultValueDeclarationSQL($field)
public function getDefaultValueDeclarationSQL($column)
{
if (! isset($field['default'])) {
return empty($field['notnull']) ? ' DEFAULT NULL' : '';
if (! isset($column['default'])) {
return empty($column['notnull']) ? ' DEFAULT NULL' : '';
}
$default = $field['default'];
$default = $column['default'];
if (! isset($field['type'])) {
if (! isset($column['type'])) {
return " DEFAULT '" . $default . "'";
}
$type = $field['type'];
$type = $column['type'];
if ($type instanceof Types\PhpIntegerMappingType) {
return ' DEFAULT ' . $default;
......@@ -2352,16 +2352,16 @@ abstract class AbstractPlatform
public function getCheckDeclarationSQL(array $definition)
{
$constraints = [];
foreach ($definition as $field => $def) {
foreach ($definition as $column => $def) {
if (is_string($def)) {
$constraints[] = 'CHECK (' . $def . ')';
} else {
if (isset($def['min'])) {
$constraints[] = 'CHECK (' . $field . ' >= ' . $def['min'] . ')';
$constraints[] = 'CHECK (' . $column . ' >= ' . $def['min'] . ')';
}
if (isset($def['max'])) {
$constraints[] = 'CHECK (' . $field . ' <= ' . $def['max'] . ')';
$constraints[] = 'CHECK (' . $column . ' <= ' . $def['max'] . ')';
}
}
}
......@@ -2421,16 +2421,16 @@ abstract class AbstractPlatform
/**
* Obtains SQL code portion needed to create a custom column,
* e.g. when a field has the "columnDefinition" keyword.
* e.g. when a column has the "columnDefinition" keyword.
* Only "AUTOINCREMENT" and "PRIMARY KEY" are added if appropriate.
*
* @param mixed[] $columnDef
* @param mixed[] $column
*
* @return string
*/
public function getCustomTypeDeclarationSQL(array $columnDef)
public function getCustomTypeDeclarationSQL(array $column)
{
return $columnDef['columnDefinition'];
return $column['columnDefinition'];
}
/**
......@@ -2495,10 +2495,10 @@ abstract class AbstractPlatform
/**
* Obtain DBMS specific SQL code portion needed to set the FOREIGN KEY constraint
* of a field declaration to be used in statements like CREATE TABLE.
* of a column declaration to be used in statements like CREATE TABLE.
*
* @return string DBMS specific SQL code portion needed to set the FOREIGN KEY constraint
* of a field declaration.
* of a column declaration.
*/
public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey)
{
......@@ -2557,7 +2557,7 @@ abstract class AbstractPlatform
/**
* Obtains DBMS specific SQL code portion needed to set the FOREIGN KEY constraint
* of a field declaration to be used in statements like CREATE TABLE.
* of a column declaration to be used in statements like CREATE TABLE.
*
* @return string
*
......@@ -2592,10 +2592,10 @@ abstract class AbstractPlatform
/**
* Obtains DBMS specific SQL code portion needed to set the UNIQUE constraint
* of a field declaration to be used in statements like CREATE TABLE.
* of a column declaration to be used in statements like CREATE TABLE.
*
* @return string DBMS specific SQL code portion needed to set the UNIQUE constraint
* of a field declaration.
* of a column declaration.
*/
public function getUniqueFieldDeclarationSQL()
{
......@@ -2604,12 +2604,12 @@ abstract class AbstractPlatform
/**
* Obtains DBMS specific SQL code portion needed to set the CHARACTER SET
* of a field declaration to be used in statements like CREATE TABLE.
* of a column declaration to be used in statements like CREATE TABLE.
*
* @param string $charset The name of the charset.
*
* @return string DBMS specific SQL code portion needed to set the CHARACTER SET
* of a field declaration.
* of a column declaration.
*/
public function getColumnCharsetDeclarationSQL($charset)
{
......@@ -2618,12 +2618,12 @@ abstract class AbstractPlatform
/**
* Obtains DBMS specific SQL code portion needed to set the COLLATION
* of a field declaration to be used in statements like CREATE TABLE.
* of a column declaration to be used in statements like CREATE TABLE.
*
* @param string $collation The name of the collation.
*
* @return string DBMS specific SQL code portion needed to set the COLLATION
* of a field declaration.
* of a column declaration.
*/
public function getColumnCollationDeclarationSQL($collation)
{
......@@ -2978,68 +2978,68 @@ abstract class AbstractPlatform
}
/**
* Obtains DBMS specific SQL to be used to create datetime fields in
* Obtains DBMS specific SQL to be used to create datetime columns in
* statements like CREATE TABLE.
*
* @param mixed[] $fieldDeclaration
* @param mixed[] $column
*
* @return string
*
* @throws DBALException If not supported on this platform.
*/
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTimeTypeDeclarationSQL(array $column)
{
throw DBALException::notSupported(__METHOD__);
}
/**
* Obtains DBMS specific SQL to be used to create datetime with timezone offset fields.
* Obtains DBMS specific SQL to be used to create datetime with timezone offset columns.
*
* @param mixed[] $fieldDeclaration
* @param mixed[] $column
*
* @return string
*/
public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTimeTzTypeDeclarationSQL(array $column)
{
return $this->getDateTimeTypeDeclarationSQL($fieldDeclaration);
return $this->getDateTimeTypeDeclarationSQL($column);
}
/**
* Obtains DBMS specific SQL to be used to create date fields in statements
* Obtains DBMS specific SQL to be used to create date columns in statements
* like CREATE TABLE.
*
* @param mixed[] $fieldDeclaration
* @param mixed[] $column
*
* @return string
*
* @throws DBALException If not supported on this platform.
*/
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTypeDeclarationSQL(array $column)
{
throw DBALException::notSupported(__METHOD__);
}
/**
* Obtains DBMS specific SQL to be used to create time fields in statements
* Obtains DBMS specific SQL to be used to create time columns in statements
* like CREATE TABLE.
*
* @param mixed[] $fieldDeclaration
* @param mixed[] $column
*
* @return string
*
* @throws DBALException If not supported on this platform.
*/
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getTimeTypeDeclarationSQL(array $column)
{
throw DBALException::notSupported(__METHOD__);
}
/**
* @param mixed[] $fieldDeclaration
* @param mixed[] $column
*
* @return string
*/
public function getFloatDeclarationSQL(array $fieldDeclaration)
public function getFloatDeclarationSQL(array $column)
{
return 'DOUBLE PRECISION';
}
......
......@@ -47,22 +47,22 @@ class DB2Platform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getVarcharTypeDeclarationSQL(array $field)
public function getVarcharTypeDeclarationSQL(array $column)
{
// for IBM DB2, the CHAR max length is less than VARCHAR default length
if (! isset($field['length']) && ! empty($field['fixed'])) {
$field['length'] = $this->getCharMaxLength();
if (! isset($column['length']) && ! empty($column['fixed'])) {
$column['length'] = $this->getCharMaxLength();
}
return parent::getVarcharTypeDeclarationSQL($field);
return parent::getVarcharTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
public function getBlobTypeDeclarationSQL(array $field)
public function getBlobTypeDeclarationSQL(array $column)
{
// todo blob(n) with $field['length'];
// todo blob(n) with $column['length'];
return 'BLOB(1M)';
}
......@@ -124,9 +124,9 @@ class DB2Platform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getClobTypeDeclarationSQL(array $field)
public function getClobTypeDeclarationSQL(array $column)
{
// todo clob(n) with $field['length'];
// todo clob(n) with $column['length'];
return 'CLOB(1M)';
}
......@@ -141,7 +141,7 @@ class DB2Platform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getBooleanTypeDeclarationSQL(array $columnDef)
public function getBooleanTypeDeclarationSQL(array $column)
{
return 'SMALLINT';
}
......@@ -149,34 +149,34 @@ class DB2Platform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getIntegerTypeDeclarationSQL(array $columnDef)
public function getIntegerTypeDeclarationSQL(array $column)
{
return 'INTEGER' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
return 'INTEGER' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
public function getBigIntTypeDeclarationSQL(array $columnDef)
public function getBigIntTypeDeclarationSQL(array $column)
{
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
public function getSmallIntTypeDeclarationSQL(array $columnDef)
public function getSmallIntTypeDeclarationSQL(array $column)
{
return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
protected function _getCommonIntegerTypeDeclarationSQL(array $column)
{
$autoinc = '';
if (! empty($columnDef['autoincrement'])) {
if (! empty($column['autoincrement'])) {
$autoinc = ' GENERATED BY DEFAULT AS IDENTITY';
}
......@@ -230,9 +230,9 @@ class DB2Platform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTimeTypeDeclarationSQL(array $column)
{
if (isset($fieldDeclaration['version']) && $fieldDeclaration['version'] === true) {
if (isset($column['version']) && $column['version'] === true) {
return 'TIMESTAMP(0) WITH DEFAULT';
}
......@@ -242,7 +242,7 @@ class DB2Platform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTypeDeclarationSQL(array $column)
{
return 'DATE';
}
......@@ -250,7 +250,7 @@ class DB2Platform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getTimeTypeDeclarationSQL(array $column)
{
return 'TIME';
}
......@@ -750,19 +750,19 @@ class DB2Platform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getDefaultValueDeclarationSQL($field)
public function getDefaultValueDeclarationSQL($column)
{
if (! empty($field['autoincrement'])) {
if (! empty($column['autoincrement'])) {
return '';
}
if (isset($field['version']) && $field['version']) {
if ((string) $field['type'] !== 'DateTime') {
$field['default'] = '1';
if (isset($column['version']) && $column['version']) {
if ((string) $column['type'] !== 'DateTime') {
$column['default'] = '1';
}
}
return parent::getDefaultValueDeclarationSQL($field);
return parent::getDefaultValueDeclarationSQL($column);
}
/**
......
......@@ -72,7 +72,7 @@ class DrizzlePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getBooleanTypeDeclarationSQL(array $field)
public function getBooleanTypeDeclarationSQL(array $column)
{
return 'BOOLEAN';
}
......@@ -80,18 +80,18 @@ class DrizzlePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getIntegerTypeDeclarationSQL(array $field)
public function getIntegerTypeDeclarationSQL(array $column)
{
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
protected function _getCommonIntegerTypeDeclarationSQL(array $column)
{
$autoinc = '';
if (! empty($columnDef['autoincrement'])) {
if (! empty($column['autoincrement'])) {
$autoinc = ' AUTO_INCREMENT';
}
......@@ -101,17 +101,17 @@ class DrizzlePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getBigIntTypeDeclarationSQL(array $field)
public function getBigIntTypeDeclarationSQL(array $column)
{
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
public function getSmallIntTypeDeclarationSQL(array $field)
public function getSmallIntTypeDeclarationSQL(array $column)
{
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
......@@ -155,7 +155,7 @@ class DrizzlePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getClobTypeDeclarationSQL(array $field)
public function getClobTypeDeclarationSQL(array $column)
{
return 'TEXT';
}
......@@ -163,7 +163,7 @@ class DrizzlePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getBlobTypeDeclarationSQL(array $field)
public function getBlobTypeDeclarationSQL(array $column)
{
return 'BLOB';
}
......@@ -451,9 +451,9 @@ class DrizzlePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTimeTypeDeclarationSQL(array $column)
{
if (isset($fieldDeclaration['version']) && $fieldDeclaration['version'] === true) {
if (isset($column['version']) && $column['version'] === true) {
return 'TIMESTAMP';
}
......@@ -463,7 +463,7 @@ class DrizzlePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getTimeTypeDeclarationSQL(array $column)
{
return 'TIME';
}
......@@ -471,7 +471,7 @@ class DrizzlePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTypeDeclarationSQL(array $column)
{
return 'DATE';
}
......
......@@ -16,7 +16,7 @@ final class MariaDb1027Platform extends MySqlPlatform
*
* @link https://mariadb.com/kb/en/library/json-data-type/
*/
public function getJsonTypeDeclarationSQL(array $field): string
public function getJsonTypeDeclarationSQL(array $column): string
{
return 'LONGTEXT';
}
......
......@@ -22,7 +22,7 @@ class MySQL57Platform extends MySqlPlatform
/**
* {@inheritdoc}
*/
public function getJsonTypeDeclarationSQL(array $field)
public function getJsonTypeDeclarationSQL(array $column)
{
return 'JSON';
}
......
......@@ -246,10 +246,10 @@ class MySqlPlatform extends AbstractPlatform
*
* {@inheritDoc}
*/
public function getClobTypeDeclarationSQL(array $field)
public function getClobTypeDeclarationSQL(array $column)
{
if (! empty($field['length']) && is_numeric($field['length'])) {
$length = $field['length'];
if (! empty($column['length']) && is_numeric($column['length'])) {
$length = $column['length'];
if ($length <= static::LENGTH_LIMIT_TINYTEXT) {
return 'TINYTEXT';
......@@ -270,9 +270,9 @@ class MySqlPlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTimeTypeDeclarationSQL(array $column)
{
if (isset($fieldDeclaration['version']) && $fieldDeclaration['version'] === true) {
if (isset($column['version']) && $column['version'] === true) {
return 'TIMESTAMP';
}
......@@ -282,7 +282,7 @@ class MySqlPlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTypeDeclarationSQL(array $column)
{
return 'DATE';
}
......@@ -290,7 +290,7 @@ class MySqlPlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getTimeTypeDeclarationSQL(array $column)
{
return 'TIME';
}
......@@ -298,21 +298,21 @@ class MySqlPlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getBooleanTypeDeclarationSQL(array $field)
public function getBooleanTypeDeclarationSQL(array $column)
{
return 'TINYINT(1)';
}
/**
* Obtain DBMS specific SQL code portion needed to set the COLLATION
* of a field declaration to be used in statements like CREATE TABLE.
* of a column declaration to be used in statements like CREATE TABLE.
*
* @deprecated Deprecated since version 2.5, Use {@link self::getColumnCollationDeclarationSQL()} instead.
*
* @param string $collation name of the collation
*
* @return string DBMS specific SQL code portion needed to set the COLLATION
* of a field declaration.
* of a column declaration.
*/
public function getCollationFieldDeclaration($collation)
{
......@@ -470,14 +470,14 @@ SQL
/**
* {@inheritdoc}
*/
public function getDefaultValueDeclarationSQL($field)
public function getDefaultValueDeclarationSQL($column)
{
// Unset the default value if the given field definition does not allow default values.
if ($field['type'] instanceof TextType || $field['type'] instanceof BlobType) {
$field['default'] = null;
// Unset the default value if the given column definition does not allow default values.
if ($column['type'] instanceof TextType || $column['type'] instanceof BlobType) {
$column['default'] = null;
}
return parent::getDefaultValueDeclarationSQL($field);
return parent::getDefaultValueDeclarationSQL($column);
}
/**
......@@ -903,41 +903,41 @@ SQL
/**
* {@inheritDoc}
*/
public function getIntegerTypeDeclarationSQL(array $field)
public function getIntegerTypeDeclarationSQL(array $column)
{
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
public function getBigIntTypeDeclarationSQL(array $field)
public function getBigIntTypeDeclarationSQL(array $column)
{
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
public function getSmallIntTypeDeclarationSQL(array $field)
public function getSmallIntTypeDeclarationSQL(array $column)
{
return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritdoc}
*/
public function getFloatDeclarationSQL(array $field)
public function getFloatDeclarationSQL(array $column)
{
return 'DOUBLE PRECISION' . $this->getUnsignedDeclaration($field);
return 'DOUBLE PRECISION' . $this->getUnsignedDeclaration($column);
}
/**
* {@inheritdoc}
*/
public function getDecimalTypeDeclarationSQL(array $columnDef)
public function getDecimalTypeDeclarationSQL(array $column)
{
return parent::getDecimalTypeDeclarationSQL($columnDef) . $this->getUnsignedDeclaration($columnDef);
return parent::getDecimalTypeDeclarationSQL($column) . $this->getUnsignedDeclaration($column);
}
/**
......@@ -955,14 +955,14 @@ SQL
/**
* {@inheritDoc}
*/
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
protected function _getCommonIntegerTypeDeclarationSQL(array $column)
{
$autoinc = '';
if (! empty($columnDef['autoincrement'])) {
if (! empty($column['autoincrement'])) {
$autoinc = ' AUTO_INCREMENT';
}
return $this->getUnsignedDeclaration($columnDef) . $autoinc;
return $this->getUnsignedDeclaration($column) . $autoinc;
}
/**
......@@ -1147,10 +1147,10 @@ SQL
*
* {@inheritDoc}
*/
public function getBlobTypeDeclarationSQL(array $field)
public function getBlobTypeDeclarationSQL(array $column)
{
if (! empty($field['length']) && is_numeric($field['length'])) {
$length = $field['length'];
if (! empty($column['length']) && is_numeric($column['length'])) {
$length = $column['length'];
if ($length <= static::LENGTH_LIMIT_TINYBLOB) {
return 'TINYBLOB';
......
......@@ -259,7 +259,7 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getBooleanTypeDeclarationSQL(array $field)
public function getBooleanTypeDeclarationSQL(array $column)
{
return 'NUMBER(1)';
}
......@@ -267,7 +267,7 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getIntegerTypeDeclarationSQL(array $field)
public function getIntegerTypeDeclarationSQL(array $column)
{
return 'NUMBER(10)';
}
......@@ -275,7 +275,7 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getBigIntTypeDeclarationSQL(array $field)
public function getBigIntTypeDeclarationSQL(array $column)
{
return 'NUMBER(20)';
}
......@@ -283,7 +283,7 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getSmallIntTypeDeclarationSQL(array $field)
public function getSmallIntTypeDeclarationSQL(array $column)
{
return 'NUMBER(5)';
}
......@@ -291,7 +291,7 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTimeTypeDeclarationSQL(array $column)
{
return 'TIMESTAMP(0)';
}
......@@ -299,7 +299,7 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTimeTzTypeDeclarationSQL(array $column)
{
return 'TIMESTAMP(0) WITH TIME ZONE';
}
......@@ -307,7 +307,7 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTypeDeclarationSQL(array $column)
{
return 'DATE';
}
......@@ -315,7 +315,7 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getTimeTypeDeclarationSQL(array $column)
{
return 'DATE';
}
......@@ -323,7 +323,7 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
protected function _getCommonIntegerTypeDeclarationSQL(array $column)
{
return '';
}
......@@ -356,7 +356,7 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getClobTypeDeclarationSQL(array $field)
public function getClobTypeDeclarationSQL(array $column)
{
return 'CLOB';
}
......@@ -923,26 +923,26 @@ SQL
/**
* {@inheritdoc}
*/
public function getColumnDeclarationSQL($name, array $field)
public function getColumnDeclarationSQL($name, array $column)
{
if (isset($field['columnDefinition'])) {
$columnDef = $this->getCustomTypeDeclarationSQL($field);
if (isset($column['columnDefinition'])) {
$columnDef = $this->getCustomTypeDeclarationSQL($column);
} else {
$default = $this->getDefaultValueDeclarationSQL($field);
$default = $this->getDefaultValueDeclarationSQL($column);
$notnull = '';
if (isset($field['notnull'])) {
$notnull = $field['notnull'] ? ' NOT NULL' : ' NULL';
if (isset($column['notnull'])) {
$notnull = $column['notnull'] ? ' NOT NULL' : ' NULL';
}
$unique = isset($field['unique']) && $field['unique'] ?
$unique = isset($column['unique']) && $column['unique'] ?
' ' . $this->getUniqueFieldDeclarationSQL() : '';
$check = isset($field['check']) && $field['check'] ?
' ' . $field['check'] : '';
$check = isset($column['check']) && $column['check'] ?
' ' . $column['check'] : '';
$typeDecl = $field['type']->getSQLDeclaration($field, $this);
$typeDecl = $column['type']->getSQLDeclaration($column, $this);
$columnDef = $typeDecl . $default . $notnull . $unique . $check;
}
......@@ -1205,7 +1205,7 @@ SQL
/**
* {@inheritDoc}
*/
public function getBlobTypeDeclarationSQL(array $field)
public function getBlobTypeDeclarationSQL(array $column)
{
return 'BLOB';
}
......
......@@ -14,7 +14,7 @@ class PostgreSQL92Platform extends PostgreSQL91Platform
/**
* {@inheritdoc}
*/
public function getJsonTypeDeclarationSQL(array $field)
public function getJsonTypeDeclarationSQL(array $column)
{
return 'JSON';
}
......@@ -22,13 +22,13 @@ class PostgreSQL92Platform extends PostgreSQL91Platform
/**
* {@inheritdoc}
*/
public function getSmallIntTypeDeclarationSQL(array $field)
public function getSmallIntTypeDeclarationSQL(array $column)
{
if (! empty($field['autoincrement'])) {
if (! empty($column['autoincrement'])) {
return 'SMALLSERIAL';
}
return parent::getSmallIntTypeDeclarationSQL($field);
return parent::getSmallIntTypeDeclarationSQL($column);
}
/**
......
......@@ -12,9 +12,9 @@ class PostgreSQL94Platform extends PostgreSQL92Platform
/**
* {@inheritdoc}
*/
public function getJsonTypeDeclarationSQL(array $field)
public function getJsonTypeDeclarationSQL(array $column)
{
if (! empty($field['jsonb'])) {
if (! empty($column['jsonb'])) {
return 'JSONB';
}
......
......@@ -944,7 +944,7 @@ SQL
/**
* {@inheritDoc}
*/
public function getBooleanTypeDeclarationSQL(array $field)
public function getBooleanTypeDeclarationSQL(array $column)
{
return 'BOOLEAN';
}
......@@ -952,9 +952,9 @@ SQL
/**
* {@inheritDoc}
*/
public function getIntegerTypeDeclarationSQL(array $field)
public function getIntegerTypeDeclarationSQL(array $column)
{
if (! empty($field['autoincrement'])) {
if (! empty($column['autoincrement'])) {
return 'SERIAL';
}
......@@ -964,9 +964,9 @@ SQL
/**
* {@inheritDoc}
*/
public function getBigIntTypeDeclarationSQL(array $field)
public function getBigIntTypeDeclarationSQL(array $column)
{
if (! empty($field['autoincrement'])) {
if (! empty($column['autoincrement'])) {
return 'BIGSERIAL';
}
......@@ -976,7 +976,7 @@ SQL
/**
* {@inheritDoc}
*/
public function getSmallIntTypeDeclarationSQL(array $field)
public function getSmallIntTypeDeclarationSQL(array $column)
{
return 'SMALLINT';
}
......@@ -984,7 +984,7 @@ SQL
/**
* {@inheritDoc}
*/
public function getGuidTypeDeclarationSQL(array $field)
public function getGuidTypeDeclarationSQL(array $column)
{
return 'UUID';
}
......@@ -992,7 +992,7 @@ SQL
/**
* {@inheritDoc}
*/
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTimeTypeDeclarationSQL(array $column)
{
return 'TIMESTAMP(0) WITHOUT TIME ZONE';
}
......@@ -1000,7 +1000,7 @@ SQL
/**
* {@inheritDoc}
*/
public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTimeTzTypeDeclarationSQL(array $column)
{
return 'TIMESTAMP(0) WITH TIME ZONE';
}
......@@ -1008,7 +1008,7 @@ SQL
/**
* {@inheritDoc}
*/
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTypeDeclarationSQL(array $column)
{
return 'DATE';
}
......@@ -1016,7 +1016,7 @@ SQL
/**
* {@inheritDoc}
*/
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getTimeTypeDeclarationSQL(array $column)
{
return 'TIME(0) WITHOUT TIME ZONE';
}
......@@ -1034,7 +1034,7 @@ SQL
/**
* {@inheritDoc}
*/
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
protected function _getCommonIntegerTypeDeclarationSQL(array $column)
{
return '';
}
......@@ -1059,7 +1059,7 @@ SQL
/**
* {@inheritDoc}
*/
public function getClobTypeDeclarationSQL(array $field)
public function getClobTypeDeclarationSQL(array $column)
{
return 'TEXT';
}
......@@ -1204,7 +1204,7 @@ SQL
/**
* {@inheritDoc}
*/
public function getBlobTypeDeclarationSQL(array $field)
public function getBlobTypeDeclarationSQL(array $column)
{
return 'BYTEA';
}
......@@ -1212,23 +1212,23 @@ SQL
/**
* {@inheritdoc}
*/
public function getDefaultValueDeclarationSQL($field)
public function getDefaultValueDeclarationSQL($column)
{
if ($this->isSerialField($field)) {
if ($this->isSerialColumn($column)) {
return '';
}
return parent::getDefaultValueDeclarationSQL($field);
return parent::getDefaultValueDeclarationSQL($column);
}
/**
* @param mixed[] $field
* @param mixed[] $column
*/
private function isSerialField(array $field): bool
private function isSerialColumn(array $column): bool
{
return isset($field['type'], $field['autoincrement'])
&& $field['autoincrement'] === true
&& $this->isNumericType($field['type']);
return isset($column['type'], $column['autoincrement'])
&& $column['autoincrement'] === true
&& $this->isNumericType($column['type']);
}
/**
......
......@@ -42,7 +42,7 @@ class SQLAnywhere12Platform extends SQLAnywhere11Platform
/**
* {@inheritdoc}
*/
public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTimeTzTypeDeclarationSQL(array $column)
{
return 'TIMESTAMP WITH TIME ZONE';
}
......
......@@ -298,11 +298,11 @@ class SQLAnywherePlatform extends AbstractPlatform
/**
* {@inheritdoc}
*/
public function getBigIntTypeDeclarationSQL(array $columnDef)
public function getBigIntTypeDeclarationSQL(array $column)
{
$columnDef['integer_type'] = 'BIGINT';
$column['integer_type'] = 'BIGINT';
return $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
return $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
......@@ -324,7 +324,7 @@ class SQLAnywherePlatform extends AbstractPlatform
/**
* {@inheritdoc}
*/
public function getBlobTypeDeclarationSQL(array $field)
public function getBlobTypeDeclarationSQL(array $column)
{
return 'LONG BINARY';
}
......@@ -337,9 +337,9 @@ class SQLAnywherePlatform extends AbstractPlatform
* Otherwise by just omitting the NOT NULL clause,
* SQL Anywhere will declare them NOT NULL nonetheless.
*/
public function getBooleanTypeDeclarationSQL(array $columnDef)
public function getBooleanTypeDeclarationSQL(array $column)
{
$nullClause = isset($columnDef['notnull']) && (bool) $columnDef['notnull'] === false ? ' NULL' : '';
$nullClause = isset($column['notnull']) && (bool) $column['notnull'] === false ? ' NULL' : '';
return 'BIT' . $nullClause;
}
......@@ -347,7 +347,7 @@ class SQLAnywherePlatform extends AbstractPlatform
/**
* {@inheritdoc}
*/
public function getClobTypeDeclarationSQL(array $field)
public function getClobTypeDeclarationSQL(array $column)
{
return 'TEXT';
}
......@@ -499,7 +499,7 @@ class SQLAnywherePlatform extends AbstractPlatform
/**
* {@inheritdoc}
*/
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTimeTypeDeclarationSQL(array $column)
{
return 'DATETIME';
}
......@@ -515,7 +515,7 @@ class SQLAnywherePlatform extends AbstractPlatform
/**
* {@inheritdoc}
*/
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTypeDeclarationSQL(array $column)
{
return 'DATE';
}
......@@ -678,7 +678,7 @@ class SQLAnywherePlatform extends AbstractPlatform
/**
* {@inheritdoc}
*/
public function getGuidTypeDeclarationSQL(array $field)
public function getGuidTypeDeclarationSQL(array $column)
{
return 'UNIQUEIDENTIFIER';
}
......@@ -695,11 +695,11 @@ class SQLAnywherePlatform extends AbstractPlatform
/**
* {@inheritdoc}
*/
public function getIntegerTypeDeclarationSQL(array $columnDef)
public function getIntegerTypeDeclarationSQL(array $column)
{
$columnDef['integer_type'] = 'INT';
$column['integer_type'] = 'INT';
return $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
return $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
......@@ -1039,11 +1039,11 @@ SQL
/**
* {@inheritdoc}
*/
public function getSmallIntTypeDeclarationSQL(array $columnDef)
public function getSmallIntTypeDeclarationSQL(array $column)
{
$columnDef['integer_type'] = 'SMALLINT';
$column['integer_type'] = 'SMALLINT';
return $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
return $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
......@@ -1116,7 +1116,7 @@ SQL
/**
* {@inheritdoc}
*/
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getTimeTypeDeclarationSQL(array $column)
{
return 'TIME';
}
......@@ -1236,12 +1236,12 @@ SQL
/**
* {@inheritdoc}
*/
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
protected function _getCommonIntegerTypeDeclarationSQL(array $column)
{
$unsigned = ! empty($columnDef['unsigned']) ? 'UNSIGNED ' : '';
$autoincrement = ! empty($columnDef['autoincrement']) ? ' IDENTITY' : '';
$unsigned = ! empty($column['unsigned']) ? 'UNSIGNED ' : '';
$autoincrement = ! empty($column['autoincrement']) ? ' IDENTITY' : '';
return $unsigned . $columnDef['integer_type'] . $autoincrement;
return $unsigned . $column['integer_type'] . $autoincrement;
}
/**
......
......@@ -29,7 +29,7 @@ class SQLServer2005Platform extends SQLServerPlatform
/**
* {@inheritDoc}
*/
public function getClobTypeDeclarationSQL(array $field)
public function getClobTypeDeclarationSQL(array $column)
{
return 'VARCHAR(MAX)';
}
......
......@@ -23,7 +23,7 @@ class SQLServer2008Platform extends SQLServer2005Platform
/**
* {@inheritDoc}
*/
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTimeTypeDeclarationSQL(array $column)
{
// 3 - microseconds precision length
// http://msdn.microsoft.com/en-us/library/ms187819.aspx
......@@ -33,7 +33,7 @@ class SQLServer2008Platform extends SQLServer2005Platform
/**
* {@inheritDoc}
*/
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTypeDeclarationSQL(array $column)
{
return 'DATE';
}
......@@ -41,7 +41,7 @@ class SQLServer2008Platform extends SQLServer2005Platform
/**
* {@inheritDoc}
*/
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getTimeTypeDeclarationSQL(array $column)
{
return 'TIME(0)';
}
......@@ -49,7 +49,7 @@ class SQLServer2008Platform extends SQLServer2005Platform
/**
* {@inheritDoc}
*/
public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTimeTzTypeDeclarationSQL(array $column)
{
return 'DATETIMEOFFSET(6)';
}
......
......@@ -1161,31 +1161,31 @@ SQL
/**
* {@inheritDoc}
*/
public function getIntegerTypeDeclarationSQL(array $field)
public function getIntegerTypeDeclarationSQL(array $column)
{
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
public function getBigIntTypeDeclarationSQL(array $field)
public function getBigIntTypeDeclarationSQL(array $column)
{
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
public function getSmallIntTypeDeclarationSQL(array $field)
public function getSmallIntTypeDeclarationSQL(array $column)
{
return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
public function getGuidTypeDeclarationSQL(array $field)
public function getGuidTypeDeclarationSQL(array $column)
{
return 'UNIQUEIDENTIFIER';
}
......@@ -1217,7 +1217,7 @@ SQL
/**
* {@inheritDoc}
*/
public function getClobTypeDeclarationSQL(array $field)
public function getClobTypeDeclarationSQL(array $column)
{
return 'VARCHAR(MAX)';
}
......@@ -1225,15 +1225,15 @@ SQL
/**
* {@inheritDoc}
*/
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
protected function _getCommonIntegerTypeDeclarationSQL(array $column)
{
return ! empty($columnDef['autoincrement']) ? ' IDENTITY' : '';
return ! empty($column['autoincrement']) ? ' IDENTITY' : '';
}
/**
* {@inheritDoc}
*/
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTimeTypeDeclarationSQL(array $column)
{
return 'DATETIME';
}
......@@ -1241,7 +1241,7 @@ SQL
/**
* {@inheritDoc}
*/
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTypeDeclarationSQL(array $column)
{
return 'DATETIME';
}
......@@ -1249,7 +1249,7 @@ SQL
/**
* {@inheritDoc}
*/
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getTimeTypeDeclarationSQL(array $column)
{
return 'DATETIME';
}
......@@ -1257,7 +1257,7 @@ SQL
/**
* {@inheritDoc}
*/
public function getBooleanTypeDeclarationSQL(array $field)
public function getBooleanTypeDeclarationSQL(array $column)
{
return 'BIT';
}
......@@ -1607,7 +1607,7 @@ SQL
/**
* {@inheritDoc}
*/
public function getBlobTypeDeclarationSQL(array $field)
public function getBlobTypeDeclarationSQL(array $column)
{
return 'VARBINARY(MAX)';
}
......@@ -1617,23 +1617,23 @@ SQL
*
* Modifies column declaration order as it differs in Microsoft SQL Server.
*/
public function getColumnDeclarationSQL($name, array $field)
public function getColumnDeclarationSQL($name, array $column)
{
if (isset($field['columnDefinition'])) {
$columnDef = $this->getCustomTypeDeclarationSQL($field);
if (isset($column['columnDefinition'])) {
$columnDef = $this->getCustomTypeDeclarationSQL($column);
} else {
$collation = isset($field['collation']) && $field['collation'] ?
' ' . $this->getColumnCollationDeclarationSQL($field['collation']) : '';
$collation = isset($column['collation']) && $column['collation'] ?
' ' . $this->getColumnCollationDeclarationSQL($column['collation']) : '';
$notnull = isset($field['notnull']) && $field['notnull'] ? ' NOT NULL' : '';
$notnull = isset($column['notnull']) && $column['notnull'] ? ' NOT NULL' : '';
$unique = isset($field['unique']) && $field['unique'] ?
$unique = isset($column['unique']) && $column['unique'] ?
' ' . $this->getUniqueFieldDeclarationSQL() : '';
$check = isset($field['check']) && $field['check'] ?
' ' . $field['check'] : '';
$check = isset($column['check']) && $column['check'] ?
' ' . $column['check'] : '';
$typeDecl = $field['type']->getSQLDeclaration($field, $this);
$typeDecl = $column['type']->getSQLDeclaration($column, $this);
$columnDef = $typeDecl . $collation . $notnull . $unique . $check;
}
......
......@@ -201,7 +201,7 @@ class SqlitePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getBooleanTypeDeclarationSQL(array $field)
public function getBooleanTypeDeclarationSQL(array $column)
{
return 'BOOLEAN';
}
......@@ -209,71 +209,71 @@ class SqlitePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getIntegerTypeDeclarationSQL(array $field)
public function getIntegerTypeDeclarationSQL(array $column)
{
return 'INTEGER' . $this->_getCommonIntegerTypeDeclarationSQL($field);
return 'INTEGER' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
public function getBigIntTypeDeclarationSQL(array $field)
public function getBigIntTypeDeclarationSQL(array $column)
{
// SQLite autoincrement is implicit for INTEGER PKs, but not for BIGINT fields.
if (! empty($field['autoincrement'])) {
return $this->getIntegerTypeDeclarationSQL($field);
// SQLite autoincrement is implicit for INTEGER PKs, but not for BIGINT columns
if (! empty($column['autoincrement'])) {
return $this->getIntegerTypeDeclarationSQL($column);
}
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* @param array<string, mixed> $field
* @param array<string, mixed> $column
*
* @return string
*/
public function getTinyIntTypeDeclarationSql(array $field)
public function getTinyIntTypeDeclarationSql(array $column)
{
// SQLite autoincrement is implicit for INTEGER PKs, but not for TINYINT fields.
if (! empty($field['autoincrement'])) {
return $this->getIntegerTypeDeclarationSQL($field);
// SQLite autoincrement is implicit for INTEGER PKs, but not for TINYINT columns
if (! empty($column['autoincrement'])) {
return $this->getIntegerTypeDeclarationSQL($column);
}
return 'TINYINT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
return 'TINYINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
public function getSmallIntTypeDeclarationSQL(array $field)
public function getSmallIntTypeDeclarationSQL(array $column)
{
// SQLite autoincrement is implicit for INTEGER PKs, but not for SMALLINT fields.
if (! empty($field['autoincrement'])) {
return $this->getIntegerTypeDeclarationSQL($field);
// SQLite autoincrement is implicit for INTEGER PKs, but not for SMALLINT columns
if (! empty($column['autoincrement'])) {
return $this->getIntegerTypeDeclarationSQL($column);
}
return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* @param array<string, mixed> $field
* @param array<string, mixed> $column
*
* @return string
*/
public function getMediumIntTypeDeclarationSql(array $field)
public function getMediumIntTypeDeclarationSql(array $column)
{
// SQLite autoincrement is implicit for INTEGER PKs, but not for MEDIUMINT fields.
if (! empty($field['autoincrement'])) {
return $this->getIntegerTypeDeclarationSQL($field);
// SQLite autoincrement is implicit for INTEGER PKs, but not for MEDIUMINT columns
if (! empty($column['autoincrement'])) {
return $this->getIntegerTypeDeclarationSQL($column);
}
return 'MEDIUMINT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
return 'MEDIUMINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTimeTypeDeclarationSQL(array $column)
{
return 'DATETIME';
}
......@@ -281,7 +281,7 @@ class SqlitePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
public function getDateTypeDeclarationSQL(array $column)
{
return 'DATE';
}
......@@ -289,7 +289,7 @@ class SqlitePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
public function getTimeTypeDeclarationSQL(array $column)
{
return 'TIME';
}
......@@ -297,14 +297,14 @@ class SqlitePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
protected function _getCommonIntegerTypeDeclarationSQL(array $column)
{
// sqlite autoincrement is only possible for the primary key
if (! empty($columnDef['autoincrement'])) {
if (! empty($column['autoincrement'])) {
return ' PRIMARY KEY AUTOINCREMENT';
}
return ! empty($columnDef['unsigned']) ? ' UNSIGNED' : '';
return ! empty($column['unsigned']) ? ' UNSIGNED' : '';
}
/**
......@@ -430,7 +430,7 @@ class SqlitePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getClobTypeDeclarationSQL(array $field)
public function getClobTypeDeclarationSQL(array $column)
{
return 'CLOB';
}
......@@ -740,7 +740,7 @@ class SqlitePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getBlobTypeDeclarationSQL(array $field)
public function getBlobTypeDeclarationSQL(array $column)
{
return 'BLOB';
}
......@@ -1013,22 +1013,23 @@ class SqlitePlatform extends AbstractPlatform
continue;
}
$field = array_merge(['unique' => null, 'autoincrement' => null, 'default' => null], $column->toArray());
$type = $field['type'];
$definition = array_merge(['unique' => null, 'autoincrement' => null, 'default' => null], $column->toArray());
$type = $definition['type'];
switch (true) {
case isset($field['columnDefinition']) || $field['autoincrement'] || $field['unique']:
case $type instanceof Types\DateTimeType && $field['default'] === $this->getCurrentTimestampSQL():
case $type instanceof Types\DateType && $field['default'] === $this->getCurrentDateSQL():
case $type instanceof Types\TimeType && $field['default'] === $this->getCurrentTimeSQL():
case isset($definition['columnDefinition']) || $definition['autoincrement'] || $definition['unique']:
case $type instanceof Types\DateTimeType && $definition['default'] === $this->getCurrentTimestampSQL():
case $type instanceof Types\DateType && $definition['default'] === $this->getCurrentDateSQL():
case $type instanceof Types\TimeType && $definition['default'] === $this->getCurrentTimeSQL():
return false;
}
$field['name'] = $column->getQuotedName($this);
if ($type instanceof Types\StringType && $field['length'] === null) {
$field['length'] = 255;
$definition['name'] = $column->getQuotedName($this);
if ($type instanceof Types\StringType && $definition['length'] === null) {
$definition['length'] = 255;
}
$sql[] = 'ALTER TABLE ' . $table->getQuotedName($this) . ' ADD COLUMN ' . $this->getColumnDeclarationSQL($field['name'], $field);
$sql[] = 'ALTER TABLE ' . $table->getQuotedName($this) . ' ADD COLUMN ' . $this->getColumnDeclarationSQL($definition['name'], $definition);
}
if (! $this->onSchemaAlterTable($diff, $tableSql)) {
......
......@@ -209,7 +209,7 @@ class ExpressionBuilder
/**
* Creates an IS NULL expression with the given arguments.
*
* @param string $x The field in string format to be restricted by IS NULL.
* @param string $x The expression to be restricted by IS NULL.
*
* @return string
*/
......@@ -221,7 +221,7 @@ class ExpressionBuilder
/**
* Creates an IS NOT NULL expression with the given arguments.
*
* @param string $x The field in string format to be restricted by IS NOT NULL.
* @param string $x The expression to be restricted by IS NOT NULL.
*
* @return string
*/
......@@ -274,7 +274,7 @@ class ExpressionBuilder
/**
* Creates a NOT IN () comparison expression with the given arguments.
*
* @param string $x The field in string format to be inspected by NOT IN() comparison.
* @param string $x The expression to be inspected by NOT IN() comparison.
* @param string|string[] $y The placeholder or the array of values to be used by NOT IN() comparison.
*
* @return string
......
......@@ -145,7 +145,7 @@ abstract class AbstractSchemaManager
* Lists the columns for a given table.
*
* In contrast to other libraries and to the old version of Doctrine,
* this column definition does try to contain the 'primary' field for
* this column definition does try to contain the 'primary' column for
* the reason that it is not portable across different RDBMS. Use
* {@see listTableIndexes($tableName)} to retrieve the primary key
* of a table. Where a RDBMS specifies more details, these are held
......
......@@ -199,7 +199,7 @@ class Comparator
$table1Columns = $table1->getColumns();
$table2Columns = $table2->getColumns();
/* See if all the fields in table 1 exist in table 2 */
/* See if all the columns in table 1 exist in table 2 */
foreach ($table2Columns as $columnName => $column) {
if ($table1->hasColumn($columnName)) {
continue;
......@@ -209,7 +209,7 @@ class Comparator
$changes++;
}
/* See if there are any removed fields in table 2 */
/* See if there are any removed columns in table 2 */
foreach ($table1Columns as $columnName => $column) {
// See if column is removed in table 2.
if (! $table2->hasColumn($columnName)) {
......@@ -414,7 +414,7 @@ class Comparator
}
/**
* Returns the difference between the fields $field1 and $field2.
* Returns the difference between the columns
*
* If there are differences this method returns $field2, otherwise the
* boolean false.
......
......@@ -16,21 +16,21 @@ class TableDiff
public $newName = false;
/**
* All added fields.
* All added columns
*
* @var Column[]
*/
public $addedColumns;
/**
* All changed fields.
* All changed columns
*
* @var ColumnDiff[]
*/
public $changedColumns = [];
/**
* All removed fields.
* All removed columns
*
* @var Column[]
*/
......
......@@ -19,9 +19,9 @@ class ArrayType extends Type
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getClobTypeDeclarationSQL($fieldDeclaration);
return $platform->getClobTypeDeclarationSQL($column);
}
/**
......
......@@ -21,9 +21,9 @@ class BigIntType extends Type implements PhpIntegerMappingType
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getBigIntTypeDeclarationSQL($fieldDeclaration);
return $platform->getBigIntTypeDeclarationSQL($column);
}
/**
......
......@@ -20,9 +20,9 @@ class BinaryType extends Type
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getBinaryTypeDeclarationSQL($fieldDeclaration);
return $platform->getBinaryTypeDeclarationSQL($column);
}
/**
......
......@@ -20,9 +20,9 @@ class BlobType extends Type
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getBlobTypeDeclarationSQL($fieldDeclaration);
return $platform->getBlobTypeDeclarationSQL($column);
}
/**
......
......@@ -13,9 +13,9 @@ class BooleanType extends Type
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getBooleanTypeDeclarationSQL($fieldDeclaration);
return $platform->getBooleanTypeDeclarationSQL($column);
}
/**
......
......@@ -26,11 +26,11 @@ class DateIntervalType extends Type
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
$fieldDeclaration['length'] = 255;
$column['length'] = 255;
return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration);
return $platform->getVarcharTypeDeclarationSQL($column);
}
/**
......
......@@ -24,9 +24,9 @@ class DateTimeType extends Type implements PhpDateTimeMappingType
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getDateTimeTypeDeclarationSQL($fieldDeclaration);
return $platform->getDateTimeTypeDeclarationSQL($column);
}
/**
......
......@@ -35,9 +35,9 @@ class DateTimeTzType extends Type implements PhpDateTimeMappingType
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getDateTimeTzTypeDeclarationSQL($fieldDeclaration);
return $platform->getDateTimeTzTypeDeclarationSQL($column);
}
/**
......
......@@ -22,9 +22,9 @@ class DateType extends Type
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getDateTypeDeclarationSQL($fieldDeclaration);
return $platform->getDateTypeDeclarationSQL($column);
}
/**
......
......@@ -20,9 +20,9 @@ class DecimalType extends Type
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getDecimalTypeDeclarationSQL($fieldDeclaration);
return $platform->getDecimalTypeDeclarationSQL($column);
}
/**
......
......@@ -17,9 +17,9 @@ class FloatType extends Type
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getFloatDeclarationSQL($fieldDeclaration);
return $platform->getFloatDeclarationSQL($column);
}
/**
......
......@@ -12,9 +12,9 @@ class GuidType extends StringType
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getGuidTypeDeclarationSQL($fieldDeclaration);
return $platform->getGuidTypeDeclarationSQL($column);
}
/**
......
......@@ -21,9 +21,9 @@ class IntegerType extends Type implements PhpIntegerMappingType
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getIntegerTypeDeclarationSQL($fieldDeclaration);
return $platform->getIntegerTypeDeclarationSQL($column);
}
/**
......
......@@ -21,9 +21,9 @@ class JsonType extends Type
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getJsonTypeDeclarationSQL($fieldDeclaration);
return $platform->getJsonTypeDeclarationSQL($column);
}
/**
......
......@@ -19,9 +19,9 @@ class ObjectType extends Type
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getClobTypeDeclarationSQL($fieldDeclaration);
return $platform->getClobTypeDeclarationSQL($column);
}
/**
......
......@@ -19,9 +19,9 @@ class SimpleArrayType extends Type
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getClobTypeDeclarationSQL($fieldDeclaration);
return $platform->getClobTypeDeclarationSQL($column);
}
/**
......
......@@ -21,9 +21,9 @@ class SmallIntType extends Type implements PhpIntegerMappingType
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getSmallIntTypeDeclarationSQL($fieldDeclaration);
return $platform->getSmallIntTypeDeclarationSQL($column);
}
/**
......
......@@ -12,9 +12,9 @@ class StringType extends Type
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration);
return $platform->getVarcharTypeDeclarationSQL($column);
}
/**
......
......@@ -15,9 +15,9 @@ class TextType extends Type
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getClobTypeDeclarationSQL($fieldDeclaration);
return $platform->getClobTypeDeclarationSQL($column);
}
/**
......
......@@ -22,9 +22,9 @@ class TimeType extends Type
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return $platform->getTimeTypeDeclarationSQL($fieldDeclaration);
return $platform->getTimeTypeDeclarationSQL($column);
}
/**
......
......@@ -176,14 +176,14 @@ abstract class Type
}
/**
* Gets the SQL declaration snippet for a field of this type.
* Gets the SQL declaration snippet for a column of this type.
*
* @param mixed[] $fieldDeclaration The field declaration.
* @param mixed[] $column The column definition
* @param AbstractPlatform $platform The currently used database platform.
*
* @return string
*/
abstract public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform);
abstract public function getSQLDeclaration(array $column, AbstractPlatform $platform);
/**
* Gets the name of this type.
......
......@@ -28,8 +28,8 @@ class BlobTest extends DbalFunctionalTestCase
$table = new Table('blob_table');
$table->addColumn('id', 'integer');
$table->addColumn('clobfield', 'text');
$table->addColumn('blobfield', 'blob');
$table->addColumn('clobcolumn', 'text');
$table->addColumn('blobcolumn', 'blob');
$table->setPrimaryKey(['id']);
$sm = $this->connection->getSchemaManager();
......@@ -40,8 +40,8 @@ class BlobTest extends DbalFunctionalTestCase
{
$ret = $this->connection->insert('blob_table', [
'id' => 1,
'clobfield' => 'test',
'blobfield' => 'test',
'clobcolumn' => 'test',
'blobcolumn' => 'test',
], [
ParameterType::INTEGER,
ParameterType::STRING,
......@@ -61,8 +61,8 @@ class BlobTest extends DbalFunctionalTestCase
$longBlob = str_repeat('x', 4 * 8192); // send 4 chunks
$this->connection->insert('blob_table', [
'id' => 1,
'clobfield' => 'ignored',
'blobfield' => fopen('data://text/plain,' . $longBlob, 'r'),
'clobcolumn' => 'ignored',
'blobcolumn' => fopen('data://text/plain,' . $longBlob, 'r'),
], [
ParameterType::INTEGER,
ParameterType::STRING,
......@@ -76,8 +76,8 @@ class BlobTest extends DbalFunctionalTestCase
{
$this->connection->insert('blob_table', [
'id' => 1,
'clobfield' => 'test',
'blobfield' => 'test',
'clobcolumn' => 'test',
'blobcolumn' => 'test',
], [
ParameterType::INTEGER,
ParameterType::STRING,
......@@ -91,15 +91,15 @@ class BlobTest extends DbalFunctionalTestCase
{
$this->connection->insert('blob_table', [
'id' => 1,
'clobfield' => 'test',
'blobfield' => 'test',
'clobcolumn' => 'test',
'blobcolumn' => 'test',
], [
ParameterType::INTEGER,
ParameterType::STRING,
ParameterType::LARGE_OBJECT,
]);
$this->connection->update('blob_table', ['blobfield' => 'test2'], ['id' => 1], [
$this->connection->update('blob_table', ['blobcolumn' => 'test2'], ['id' => 1], [
ParameterType::LARGE_OBJECT,
ParameterType::INTEGER,
]);
......@@ -116,8 +116,8 @@ class BlobTest extends DbalFunctionalTestCase
$this->connection->insert('blob_table', [
'id' => 1,
'clobfield' => 'ignored',
'blobfield' => 'test',
'clobcolumn' => 'ignored',
'blobcolumn' => 'test',
], [
ParameterType::INTEGER,
ParameterType::STRING,
......@@ -126,7 +126,7 @@ class BlobTest extends DbalFunctionalTestCase
$this->connection->update('blob_table', [
'id' => 1,
'blobfield' => fopen('data://text/plain,test2', 'r'),
'blobcolumn' => fopen('data://text/plain,test2', 'r'),
], ['id' => 1], [
ParameterType::INTEGER,
ParameterType::LARGE_OBJECT,
......@@ -141,7 +141,7 @@ class BlobTest extends DbalFunctionalTestCase
$this->markTestIncomplete('The oci8 driver does not support stream resources as parameters');
}
$stmt = $this->connection->prepare("INSERT INTO blob_table(id, clobfield, blobfield) VALUES (1, 'ignored', ?)");
$stmt = $this->connection->prepare("INSERT INTO blob_table(id, clobcolumn, blobcolumn) VALUES (1, 'ignored', ?)");
$stream = null;
$stmt->bindParam(1, $stream, ParameterType::LARGE_OBJECT);
......@@ -156,7 +156,7 @@ class BlobTest extends DbalFunctionalTestCase
private function assertBlobContains(string $text): void
{
$rows = $this->connection->query('SELECT blobfield FROM blob_table')->fetchAll(FetchMode::COLUMN);
$rows = $this->connection->query('SELECT blobcolumn FROM blob_table')->fetchAll(FetchMode::COLUMN);
self::assertCount(1, $rows);
......
......@@ -236,7 +236,7 @@ class ExceptionTest extends DbalFunctionalTestCase
{
$schema = new Schema();
$table = $schema->createTable('bad_fieldname_table');
$table = $schema->createTable('bad_columnname_table');
$table->addColumn('id', 'integer', []);
foreach ($schema->toSql($this->connection->getDatabasePlatform()) as $sql) {
......@@ -244,7 +244,7 @@ class ExceptionTest extends DbalFunctionalTestCase
}
$this->expectException(Exception\InvalidFieldNameException::class);
$this->connection->insert('bad_fieldname_table', ['name' => 5]);
$this->connection->insert('bad_columnname_table', ['name' => 5]);
}
public function testNonUniqueFieldNameException(): void
......@@ -270,7 +270,7 @@ class ExceptionTest extends DbalFunctionalTestCase
{
$schema = new Schema();
$table = $schema->createTable('unique_field_table');
$table = $schema->createTable('unique_column_table');
$table->addColumn('id', 'integer');
$table->addUniqueIndex(['id']);
......@@ -278,9 +278,9 @@ class ExceptionTest extends DbalFunctionalTestCase
$this->connection->exec($sql);
}
$this->connection->insert('unique_field_table', ['id' => 5]);
$this->connection->insert('unique_column_table', ['id' => 5]);
$this->expectException(Exception\UniqueConstraintViolationException::class);
$this->connection->insert('unique_field_table', ['id' => 5]);
$this->connection->insert('unique_column_table', ['id' => 5]);
}
public function testSyntaxErrorException(): void
......
......@@ -138,13 +138,12 @@ class PortabilityTest extends DbalFunctionalTestCase
*
* @dataProvider fetchAllColumnProvider
*/
public function testFetchAllColumn(string $field, array $expected): void
public function testFetchAllColumn(string $column, array $expected): void
{
$conn = $this->getPortableConnection();
$stmt = $conn->query('SELECT ' . $field . ' FROM portability_table');
$stmt = $conn->query('SELECT ' . $column . ' FROM portability_table');
$column = $stmt->fetchAll(FetchMode::COLUMN);
self::assertEquals($expected, $column);
self::assertEquals($expected, $stmt->fetchAll(FetchMode::COLUMN));
}
/**
......
......@@ -516,7 +516,7 @@ class MoneyType extends Type
/**
* {@inheritDoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return 'MyMoney';
}
......
......@@ -350,8 +350,10 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
public function testGetCustomColumnDeclarationSql(): void
{
$field = ['columnDefinition' => 'MEDIUMINT(6) UNSIGNED'];
self::assertEquals('foo MEDIUMINT(6) UNSIGNED', $this->platform->getColumnDeclarationSQL('foo', $field));
self::assertEquals(
'foo MEDIUMINT(6) UNSIGNED',
$this->platform->getColumnDeclarationSQL('foo', ['columnDefinition' => 'MEDIUMINT(6) UNSIGNED'])
);
}
public function testGetCreateTableSqlDispatchEvent(): void
......@@ -516,26 +518,22 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
public function testGetDefaultValueDeclarationSQL(): void
{
// non-timestamp value will get single quotes
$field = [
self::assertEquals(" DEFAULT 'non_timestamp'", $this->platform->getDefaultValueDeclarationSQL([
'type' => Type::getType('string'),
'default' => 'non_timestamp',
];
self::assertEquals(" DEFAULT 'non_timestamp'", $this->platform->getDefaultValueDeclarationSQL($field));
]));
}
public function testGetDefaultValueDeclarationSQLDateTime(): void
{
// timestamps on datetime types should not be quoted
foreach (['datetime', 'datetimetz', 'datetime_immutable', 'datetimetz_immutable'] as $type) {
$field = [
'type' => Type::getType($type),
'default' => $this->platform->getCurrentTimestampSQL(),
];
self::assertSame(
' DEFAULT ' . $this->platform->getCurrentTimestampSQL(),
$this->platform->getDefaultValueDeclarationSQL($field)
$this->platform->getDefaultValueDeclarationSQL([
'type' => Type::getType($type),
'default' => $this->platform->getCurrentTimestampSQL(),
])
);
}
}
......@@ -543,14 +541,12 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
public function testGetDefaultValueDeclarationSQLForIntegerTypes(): void
{
foreach (['bigint', 'integer', 'smallint'] as $type) {
$field = [
'type' => Type::getType($type),
'default' => 1,
];
self::assertEquals(
' DEFAULT 1',
$this->platform->getDefaultValueDeclarationSQL($field)
$this->platform->getDefaultValueDeclarationSQL([
'type' => Type::getType($type),
'default' => 1,
])
);
}
}
......@@ -559,14 +555,12 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
{
$currentDateSql = $this->platform->getCurrentDateSQL();
foreach (['date', 'date_immutable'] as $type) {
$field = [
'type' => Type::getType($type),
'default' => $currentDateSql,
];
self::assertSame(
' DEFAULT ' . $currentDateSql,
$this->platform->getDefaultValueDeclarationSQL($field)
$this->platform->getDefaultValueDeclarationSQL([
'type' => Type::getType($type),
'default' => $currentDateSql,
])
);
}
}
......
......@@ -469,10 +469,10 @@ abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCas
public function testModifyLimitSubquerySimple(): void
{
$querySql = 'SELECT DISTINCT id_0 FROM '
. '(SELECT k0_.id AS id_0, k0_.field AS field_1 '
. 'FROM key_table k0_ WHERE (k0_.where_field IN (1))) dctrn_result';
$alteredSql = 'SELECT DISTINCT TOP 20 id_0 FROM (SELECT k0_.id AS id_0, k0_.field AS field_1 '
. 'FROM key_table k0_ WHERE (k0_.where_field IN (1))) dctrn_result';
. '(SELECT k0_.id AS id_0, k0_.column AS column_1 '
. 'FROM key_table k0_ WHERE (k0_.where_column IN (1))) dctrn_result';
$alteredSql = 'SELECT DISTINCT TOP 20 id_0 FROM (SELECT k0_.id AS id_0, k0_.column AS column_1 '
. 'FROM key_table k0_ WHERE (k0_.where_column IN (1))) dctrn_result';
$sql = $this->platform->modifyLimitQuery($querySql, 20);
$this->expectCteWithMaxRowNum($alteredSql, 20, $sql);
}
......@@ -1445,14 +1445,12 @@ abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCas
{
$currentDateSql = $this->platform->getCurrentDateSQL();
foreach (['date', 'date_immutable'] as $type) {
$field = [
'type' => Type::getType($type),
'default' => $currentDateSql,
];
self::assertSame(
' DEFAULT CONVERT(date, GETDATE())',
$this->platform->getDefaultValueDeclarationSQL($field)
$this->platform->getDefaultValueDeclarationSQL([
'type' => Type::getType($type),
'default' => $currentDateSql,
])
);
}
}
......
......@@ -326,10 +326,10 @@ class SQLServer2012PlatformTest extends AbstractSQLServerPlatformTestCase
public function testModifyLimitSubquerySimple(): void
{
$querySql = 'SELECT DISTINCT id_0 FROM '
. '(SELECT k0_.id AS id_0, k0_.field AS field_1 '
. 'FROM key_table k0_ WHERE (k0_.where_field IN (1))) dctrn_result';
$alteredSql = 'SELECT DISTINCT id_0 FROM (SELECT k0_.id AS id_0, k0_.field AS field_1 '
. 'FROM key_table k0_ WHERE (k0_.where_field IN (1))) dctrn_result ORDER BY 1 OFFSET 0 ROWS FETCH NEXT 20 ROWS ONLY';
. '(SELECT k0_.id AS id_0, k0_.column AS column_1 '
. 'FROM key_table k0_ WHERE (k0_.where_column IN (1))) dctrn_result';
$alteredSql = 'SELECT DISTINCT id_0 FROM (SELECT k0_.id AS id_0, k0_.column AS column_1 '
. 'FROM key_table k0_ WHERE (k0_.where_column IN (1))) dctrn_result ORDER BY 1 OFFSET 0 ROWS FETCH NEXT 20 ROWS ONLY';
$sql = $this->platform->modifyLimitQuery($querySql, 20);
self::assertEquals($alteredSql, $sql);
}
......
......@@ -58,10 +58,10 @@ class SQLParserUtilsTest extends DbalTestCase
['SELECT [d.ns:col_name] FROM my_table d WHERE [d.date] >= :param1', false, [57 => 'param1']], // Ticket DBAL-552
['SELECT * FROM foo WHERE jsonb_exists_any(foo.bar, ARRAY[:foo])', false, [56 => 'foo']], // Ticket GH-2295
['SELECT * FROM foo WHERE jsonb_exists_any(foo.bar, array[:foo])', false, [56 => 'foo']],
['SELECT table.field1, ARRAY[\'3\'] FROM schema.table table WHERE table.f1 = :foo AND ARRAY[\'3\']', false, [73 => 'foo']],
['SELECT table.field1, ARRAY[\'3\']::integer[] FROM schema.table table WHERE table.f1 = :foo AND ARRAY[\'3\']::integer[]', false, [84 => 'foo']],
['SELECT table.field1, ARRAY[:foo] FROM schema.table table WHERE table.f1 = :bar AND ARRAY[\'3\']', false, [27 => 'foo', 74 => 'bar']],
['SELECT table.field1, ARRAY[:foo]::integer[] FROM schema.table table WHERE table.f1 = :bar AND ARRAY[\'3\']::integer[]', false, [27 => 'foo', 85 => 'bar']],
['SELECT table.column1, ARRAY[\'3\'] FROM schema.table table WHERE table.f1 = :foo AND ARRAY[\'3\']', false, [74 => 'foo']],
['SELECT table.column1, ARRAY[\'3\']::integer[] FROM schema.table table WHERE table.f1 = :foo AND ARRAY[\'3\']::integer[]', false, [85 => 'foo']],
['SELECT table.column1, ARRAY[:foo] FROM schema.table table WHERE table.f1 = :bar AND ARRAY[\'3\']', false, [28 => 'foo', 75 => 'bar']],
['SELECT table.column1, ARRAY[:foo]::integer[] FROM schema.table table WHERE table.f1 = :bar AND ARRAY[\'3\']::integer[]', false, [28 => 'foo', 86 => 'bar']],
[
<<<'SQLDATA'
SELECT * FROM foo WHERE
......
......@@ -27,7 +27,7 @@ class ComparatorTest extends TestCase
'bugdb' => new Table(
'bugdb',
[
'integerfield1' => new Column('integerfield1', Type::getType('integer')),
'integercolumn1' => new Column('integercolumn1', Type::getType('integer')),
]
),
]);
......@@ -35,7 +35,7 @@ class ComparatorTest extends TestCase
'bugdb' => new Table(
'bugdb',
[
'integerfield1' => new Column('integerfield1', Type::getType('integer')),
'integercolumn1' => new Column('integercolumn1', Type::getType('integer')),
]
),
]);
......@@ -51,8 +51,8 @@ class ComparatorTest extends TestCase
'bugdb' => new Table(
'bugdb',
[
'integerfield1' => new Column('integerfield1', Type::getType('integer')),
'integerfield2' => new Column('integerfield2', Type::getType('integer')),
'integercolumn1' => new Column('integercolumn1', Type::getType('integer')),
'integercolumn2' => new Column('integercolumn2', Type::getType('integer')),
]
),
]);
......@@ -60,8 +60,8 @@ class ComparatorTest extends TestCase
'bugdb' => new Table(
'bugdb',
[
'integerfield2' => new Column('integerfield2', Type::getType('integer')),
'integerfield1' => new Column('integerfield1', Type::getType('integer')),
'integercolumn2' => new Column('integercolumn2', Type::getType('integer')),
'integercolumn1' => new Column('integercolumn1', Type::getType('integer')),
]
),
]);
......@@ -74,7 +74,7 @@ class ComparatorTest extends TestCase
public function testCompareMissingTable(): void
{
$schemaConfig = new SchemaConfig();
$table = new Table('bugdb', ['integerfield1' => new Column('integerfield1', Type::getType('integer'))]);
$table = new Table('bugdb', ['integercolumn1' => new Column('integercolumn1', Type::getType('integer'))]);
$table->setSchemaConfig($schemaConfig);
$schema1 = new Schema([$table], [], $schemaConfig);
......@@ -88,7 +88,7 @@ class ComparatorTest extends TestCase
public function testCompareNewTable(): void
{
$schemaConfig = new SchemaConfig();
$table = new Table('bugdb', ['integerfield1' => new Column('integerfield1', Type::getType('integer'))]);
$table = new Table('bugdb', ['integercolumn1' => new Column('integercolumn1', Type::getType('integer'))]);
$table->setSchemaConfig($schemaConfig);
$schema1 = new Schema([], [], $schemaConfig);
......@@ -112,13 +112,13 @@ class ComparatorTest extends TestCase
public function testCompareMissingField(): void
{
$missingColumn = new Column('integerfield1', Type::getType('integer'));
$missingColumn = new Column('integercolumn1', Type::getType('integer'));
$schema1 = new Schema([
'bugdb' => new Table(
'bugdb',
[
'integerfield1' => $missingColumn,
'integerfield2' => new Column('integerfield2', Type::getType('integer')),
'integercolumn1' => $missingColumn,
'integercolumn2' => new Column('integercolumn2', Type::getType('integer')),
]
),
]);
......@@ -126,7 +126,7 @@ class ComparatorTest extends TestCase
'bugdb' => new Table(
'bugdb',
[
'integerfield2' => new Column('integerfield2', Type::getType('integer')),
'integercolumn2' => new Column('integercolumn2', Type::getType('integer')),
]
),
]);
......@@ -138,7 +138,7 @@ class ComparatorTest extends TestCase
'bugdb',
[],
[],
['integerfield1' => $missingColumn]
['integercolumn1' => $missingColumn]
),
]
);
......@@ -154,7 +154,7 @@ class ComparatorTest extends TestCase
'bugdb' => new Table(
'bugdb',
[
'integerfield1' => new Column('integerfield1', Type::getType('integer')),
'integercolumn1' => new Column('integercolumn1', Type::getType('integer')),
]
),
]);
......@@ -162,8 +162,8 @@ class ComparatorTest extends TestCase
'bugdb' => new Table(
'bugdb',
[
'integerfield1' => new Column('integerfield1', Type::getType('integer')),
'integerfield2' => new Column('integerfield2', Type::getType('integer')),
'integercolumn1' => new Column('integercolumn1', Type::getType('integer')),
'integercolumn2' => new Column('integercolumn2', Type::getType('integer')),
]
),
]);
......@@ -174,7 +174,7 @@ class ComparatorTest extends TestCase
'bugdb' => new TableDiff(
'bugdb',
[
'integerfield2' => new Column('integerfield2', Type::getType('integer')),
'integercolumn2' => new Column('integercolumn2', Type::getType('integer')),
]
),
]
......@@ -187,8 +187,8 @@ class ComparatorTest extends TestCase
public function testCompareChangedColumnsChangeType(): void
{
$column1 = new Column('charfield1', Type::getType('string'));
$column2 = new Column('charfield1', Type::getType('integer'));
$column1 = new Column('charcolumn1', Type::getType('string'));
$column2 = new Column('charcolumn1', Type::getType('integer'));
$c = new Comparator();
self::assertEquals(['type'], $c->diffColumn($column1, $column2));
......@@ -201,8 +201,8 @@ class ComparatorTest extends TestCase
Type::overrideType('integer', get_class($integerType1));
$integerType2 = Type::getType('integer');
$column1 = new Column('integerfield1', $integerType1);
$column2 = new Column('integerfield1', $integerType2);
$column1 = new Column('integercolumn1', $integerType1);
$column2 = new Column('integercolumn1', $integerType2);
$c = new Comparator();
self::assertEquals([], $c->diffColumn($column1, $column2));
......@@ -218,8 +218,8 @@ class ComparatorTest extends TestCase
Type::overrideType('string', get_class($oldStringInstance));
$column1 = new Column('integerfield1', $integerType);
$column2 = new Column('integerfield1', $overriddenStringType);
$column1 = new Column('integercolumn1', $integerType);
$column2 = new Column('integercolumn1', $overriddenStringType);
$c = new Comparator();
self::assertEquals([], $c->diffColumn($column1, $column2));
......@@ -227,8 +227,8 @@ class ComparatorTest extends TestCase
public function testCompareChangedColumnsChangeCustomSchemaOption(): void
{
$column1 = new Column('charfield1', Type::getType('string'));
$column2 = new Column('charfield1', Type::getType('string'));
$column1 = new Column('charcolumn1', Type::getType('string'));
$column2 = new Column('charcolumn1', Type::getType('string'));
$column1->setCustomSchemaOption('foo', 'bar');
$column2->setCustomSchemaOption('foo', 'bar');
......@@ -244,21 +244,21 @@ class ComparatorTest extends TestCase
public function testCompareChangeColumnsMultipleNewColumnsRename(): void
{
$tableA = new Table('foo');
$tableA->addColumn('datefield1', 'datetime');
$tableA->addColumn('datecolumn1', 'datetime');
$tableB = new Table('foo');
$tableB->addColumn('new_datefield1', 'datetime');
$tableB->addColumn('new_datefield2', 'datetime');
$tableB->addColumn('new_datecolumn1', 'datetime');
$tableB->addColumn('new_datecolumn2', 'datetime');
$c = new Comparator();
$tableDiff = $c->diffTable($tableA, $tableB);
self::assertCount(1, $tableDiff->renamedColumns, 'we should have one rename datefield1 => new_datefield1.');
self::assertArrayHasKey('datefield1', $tableDiff->renamedColumns, "'datefield1' should be set to be renamed to new_datefield1");
self::assertCount(1, $tableDiff->addedColumns, "'new_datefield2' should be added");
self::assertArrayHasKey('new_datefield2', $tableDiff->addedColumns, "'new_datefield2' should be added, not created through renaming!");
self::assertCount(1, $tableDiff->renamedColumns, 'we should have one rename datecolumn1 => new_datecolumn1.');
self::assertArrayHasKey('datecolumn1', $tableDiff->renamedColumns, "'datecolumn1' should be set to be renamed to new_datecolumn1");
self::assertCount(1, $tableDiff->addedColumns, "'new_datecolumn2' should be added");
self::assertArrayHasKey('new_datecolumn2', $tableDiff->addedColumns, "'new_datecolumn2' should be added, not created through renaming!");
self::assertCount(0, $tableDiff->removedColumns, 'Nothing should be removed.');
self::assertCount(0, $tableDiff->changedColumns, 'Nothing should be changed as all fields old & new have diff names.');
self::assertCount(0, $tableDiff->changedColumns, 'Nothing should be changed as all columns old & new have diff names.');
}
public function testCompareRemovedIndex(): void
......@@ -267,13 +267,13 @@ class ComparatorTest extends TestCase
'bugdb' => new Table(
'bugdb',
[
'integerfield1' => new Column('integerfield1', Type::getType('integer')),
'integerfield2' => new Column('integerfield2', Type::getType('integer')),
'integercolumn1' => new Column('integercolumn1', Type::getType('integer')),
'integercolumn2' => new Column('integercolumn2', Type::getType('integer')),
],
[
'primary' => new Index(
'primary',
['integerfield1'],
['integercolumn1'],
true
),
]
......@@ -283,8 +283,8 @@ class ComparatorTest extends TestCase
'bugdb' => new Table(
'bugdb',
[
'integerfield1' => new Column('integerfield1', Type::getType('integer')),
'integerfield2' => new Column('integerfield2', Type::getType('integer')),
'integercolumn1' => new Column('integercolumn1', Type::getType('integer')),
'integercolumn2' => new Column('integercolumn2', Type::getType('integer')),
]
),
]);
......@@ -302,7 +302,7 @@ class ComparatorTest extends TestCase
[
'primary' => new Index(
'primary',
['integerfield1'],
['integercolumn1'],
true
),
]
......@@ -321,8 +321,8 @@ class ComparatorTest extends TestCase
'bugdb' => new Table(
'bugdb',
[
'integerfield1' => new Column('integerfield1', Type::getType('integer')),
'integerfield2' => new Column('integerfield2', Type::getType('integer')),
'integercolumn1' => new Column('integercolumn1', Type::getType('integer')),
'integercolumn2' => new Column('integercolumn2', Type::getType('integer')),
]
),
]);
......@@ -330,13 +330,13 @@ class ComparatorTest extends TestCase
'bugdb' => new Table(
'bugdb',
[
'integerfield1' => new Column('integerfield1', Type::getType('integer')),
'integerfield2' => new Column('integerfield2', Type::getType('integer')),
'integercolumn1' => new Column('integercolumn1', Type::getType('integer')),
'integercolumn2' => new Column('integercolumn2', Type::getType('integer')),
],
[
'primary' => new Index(
'primary',
['integerfield1'],
['integercolumn1'],
true
),
]
......@@ -354,7 +354,7 @@ class ComparatorTest extends TestCase
[
'primary' => new Index(
'primary',
['integerfield1'],
['integercolumn1'],
true
),
]
......@@ -373,13 +373,13 @@ class ComparatorTest extends TestCase
'bugdb' => new Table(
'bugdb',
[
'integerfield1' => new Column('integerfield1', Type::getType('integer')),
'integerfield2' => new Column('integerfield2', Type::getType('integer')),
'integercolumn1' => new Column('integercolumn1', Type::getType('integer')),
'integercolumn2' => new Column('integercolumn2', Type::getType('integer')),
],
[
'primary' => new Index(
'primary',
['integerfield1'],
['integercolumn1'],
true
),
]
......@@ -389,13 +389,13 @@ class ComparatorTest extends TestCase
'bugdb' => new Table(
'bugdb',
[
'integerfield1' => new Column('integerfield1', Type::getType('integer')),
'integerfield2' => new Column('integerfield2', Type::getType('integer')),
'integercolumn1' => new Column('integercolumn1', Type::getType('integer')),
'integercolumn2' => new Column('integercolumn2', Type::getType('integer')),
],
[
'primary' => new Index(
'primary',
['integerfield1', 'integerfield2'],
['integercolumn1', 'integercolumn2'],
true
),
]
......@@ -415,8 +415,8 @@ class ComparatorTest extends TestCase
'primary' => new Index(
'primary',
[
'integerfield1',
'integerfield2',
'integercolumn1',
'integercolumn2',
],
true
),
......@@ -436,11 +436,11 @@ class ComparatorTest extends TestCase
'bugdb' => new Table(
'bugdb',
[
'integerfield1' => new Column('integerfield1', Type::getType('integer')),
'integerfield2' => new Column('integerfield2', Type::getType('integer')),
'integercolumn1' => new Column('integercolumn1', Type::getType('integer')),
'integercolumn2' => new Column('integercolumn2', Type::getType('integer')),
],
[
'primary' => new Index('primary', ['integerfield1', 'integerfield2'], true),
'primary' => new Index('primary', ['integercolumn1', 'integercolumn2'], true),
]
),
]);
......@@ -448,11 +448,11 @@ class ComparatorTest extends TestCase
'bugdb' => new Table(
'bugdb',
[
'integerfield1' => new Column('integerfield1', Type::getType('integer')),
'integerfield2' => new Column('integerfield2', Type::getType('integer')),
'integercolumn1' => new Column('integercolumn1', Type::getType('integer')),
'integercolumn2' => new Column('integercolumn2', Type::getType('integer')),
],
[
'primary' => new Index('primary', ['integerfield2', 'integerfield1'], true),
'primary' => new Index('primary', ['integercolumn2', 'integercolumn1'], true),
]
),
]);
......@@ -467,7 +467,7 @@ class ComparatorTest extends TestCase
[],
[],
[
'primary' => new Index('primary', ['integerfield2', 'integerfield1'], true),
'primary' => new Index('primary', ['integercolumn2', 'integercolumn1'], true),
]
),
]
......
......@@ -20,7 +20,7 @@ class CommentedType extends Type
/**
* {@inheritDoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return strtoupper($this->getName());
}
......
......@@ -20,7 +20,7 @@ class MySqlPointType extends Type
/**
* {@inheritDoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
return strtoupper($this->getName());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment