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

parent 9ea5574e
...@@ -179,7 +179,7 @@ class MysqliStatement implements IteratorAggregate, Statement ...@@ -179,7 +179,7 @@ class MysqliStatement implements IteratorAggregate, Statement
// Bind row values _after_ storing the result. Otherwise, if mysqli is compiled with libmysql, // 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 // 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 // @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 // Make sure that the values are bound after each execution. Otherwise, if closeCursor() has been
......
...@@ -47,22 +47,22 @@ class DB2Platform extends AbstractPlatform ...@@ -47,22 +47,22 @@ class DB2Platform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getVarcharTypeDeclarationSQL(array $field) public function getVarcharTypeDeclarationSQL(array $column)
{ {
// for IBM DB2, the CHAR max length is less than VARCHAR default length // for IBM DB2, the CHAR max length is less than VARCHAR default length
if (! isset($field['length']) && ! empty($field['fixed'])) { if (! isset($column['length']) && ! empty($column['fixed'])) {
$field['length'] = $this->getCharMaxLength(); $column['length'] = $this->getCharMaxLength();
} }
return parent::getVarcharTypeDeclarationSQL($field); return parent::getVarcharTypeDeclarationSQL($column);
} }
/** /**
* {@inheritDoc} * {@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)'; return 'BLOB(1M)';
} }
...@@ -124,9 +124,9 @@ class DB2Platform extends AbstractPlatform ...@@ -124,9 +124,9 @@ class DB2Platform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@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)'; return 'CLOB(1M)';
} }
...@@ -141,7 +141,7 @@ class DB2Platform extends AbstractPlatform ...@@ -141,7 +141,7 @@ class DB2Platform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBooleanTypeDeclarationSQL(array $columnDef) public function getBooleanTypeDeclarationSQL(array $column)
{ {
return 'SMALLINT'; return 'SMALLINT';
} }
...@@ -149,34 +149,34 @@ class DB2Platform extends AbstractPlatform ...@@ -149,34 +149,34 @@ class DB2Platform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getIntegerTypeDeclarationSQL(array $columnDef) public function getIntegerTypeDeclarationSQL(array $column)
{ {
return 'INTEGER' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef); return 'INTEGER' . $this->_getCommonIntegerTypeDeclarationSQL($column);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBigIntTypeDeclarationSQL(array $columnDef) public function getBigIntTypeDeclarationSQL(array $column)
{ {
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef); return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getSmallIntTypeDeclarationSQL(array $columnDef) public function getSmallIntTypeDeclarationSQL(array $column)
{ {
return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef); return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) protected function _getCommonIntegerTypeDeclarationSQL(array $column)
{ {
$autoinc = ''; $autoinc = '';
if (! empty($columnDef['autoincrement'])) { if (! empty($column['autoincrement'])) {
$autoinc = ' GENERATED BY DEFAULT AS IDENTITY'; $autoinc = ' GENERATED BY DEFAULT AS IDENTITY';
} }
...@@ -230,9 +230,9 @@ class DB2Platform extends AbstractPlatform ...@@ -230,9 +230,9 @@ class DB2Platform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@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'; return 'TIMESTAMP(0) WITH DEFAULT';
} }
...@@ -242,7 +242,7 @@ class DB2Platform extends AbstractPlatform ...@@ -242,7 +242,7 @@ class DB2Platform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDateTypeDeclarationSQL(array $fieldDeclaration) public function getDateTypeDeclarationSQL(array $column)
{ {
return 'DATE'; return 'DATE';
} }
...@@ -250,7 +250,7 @@ class DB2Platform extends AbstractPlatform ...@@ -250,7 +250,7 @@ class DB2Platform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getTimeTypeDeclarationSQL(array $fieldDeclaration) public function getTimeTypeDeclarationSQL(array $column)
{ {
return 'TIME'; return 'TIME';
} }
...@@ -750,19 +750,19 @@ class DB2Platform extends AbstractPlatform ...@@ -750,19 +750,19 @@ class DB2Platform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDefaultValueDeclarationSQL($field) public function getDefaultValueDeclarationSQL($column)
{ {
if (! empty($field['autoincrement'])) { if (! empty($column['autoincrement'])) {
return ''; return '';
} }
if (isset($field['version']) && $field['version']) { if (isset($column['version']) && $column['version']) {
if ((string) $field['type'] !== 'DateTime') { if ((string) $column['type'] !== 'DateTime') {
$field['default'] = '1'; $column['default'] = '1';
} }
} }
return parent::getDefaultValueDeclarationSQL($field); return parent::getDefaultValueDeclarationSQL($column);
} }
/** /**
......
...@@ -72,7 +72,7 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -72,7 +72,7 @@ class DrizzlePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBooleanTypeDeclarationSQL(array $field) public function getBooleanTypeDeclarationSQL(array $column)
{ {
return 'BOOLEAN'; return 'BOOLEAN';
} }
...@@ -80,18 +80,18 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -80,18 +80,18 @@ class DrizzlePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getIntegerTypeDeclarationSQL(array $field) public function getIntegerTypeDeclarationSQL(array $column)
{ {
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field); return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) protected function _getCommonIntegerTypeDeclarationSQL(array $column)
{ {
$autoinc = ''; $autoinc = '';
if (! empty($columnDef['autoincrement'])) { if (! empty($column['autoincrement'])) {
$autoinc = ' AUTO_INCREMENT'; $autoinc = ' AUTO_INCREMENT';
} }
...@@ -101,17 +101,17 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -101,17 +101,17 @@ class DrizzlePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBigIntTypeDeclarationSQL(array $field) public function getBigIntTypeDeclarationSQL(array $column)
{ {
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
} }
/** /**
* {@inheritDoc} * {@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 ...@@ -155,7 +155,7 @@ class DrizzlePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getClobTypeDeclarationSQL(array $field) public function getClobTypeDeclarationSQL(array $column)
{ {
return 'TEXT'; return 'TEXT';
} }
...@@ -163,7 +163,7 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -163,7 +163,7 @@ class DrizzlePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBlobTypeDeclarationSQL(array $field) public function getBlobTypeDeclarationSQL(array $column)
{ {
return 'BLOB'; return 'BLOB';
} }
...@@ -451,9 +451,9 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -451,9 +451,9 @@ class DrizzlePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@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'; return 'TIMESTAMP';
} }
...@@ -463,7 +463,7 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -463,7 +463,7 @@ class DrizzlePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getTimeTypeDeclarationSQL(array $fieldDeclaration) public function getTimeTypeDeclarationSQL(array $column)
{ {
return 'TIME'; return 'TIME';
} }
...@@ -471,7 +471,7 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -471,7 +471,7 @@ class DrizzlePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDateTypeDeclarationSQL(array $fieldDeclaration) public function getDateTypeDeclarationSQL(array $column)
{ {
return 'DATE'; return 'DATE';
} }
......
...@@ -16,7 +16,7 @@ final class MariaDb1027Platform extends MySqlPlatform ...@@ -16,7 +16,7 @@ final class MariaDb1027Platform extends MySqlPlatform
* *
* @link https://mariadb.com/kb/en/library/json-data-type/ * @link https://mariadb.com/kb/en/library/json-data-type/
*/ */
public function getJsonTypeDeclarationSQL(array $field): string public function getJsonTypeDeclarationSQL(array $column): string
{ {
return 'LONGTEXT'; return 'LONGTEXT';
} }
......
...@@ -22,7 +22,7 @@ class MySQL57Platform extends MySqlPlatform ...@@ -22,7 +22,7 @@ class MySQL57Platform extends MySqlPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getJsonTypeDeclarationSQL(array $field) public function getJsonTypeDeclarationSQL(array $column)
{ {
return 'JSON'; return 'JSON';
} }
......
...@@ -246,10 +246,10 @@ class MySqlPlatform extends AbstractPlatform ...@@ -246,10 +246,10 @@ class MySqlPlatform extends AbstractPlatform
* *
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getClobTypeDeclarationSQL(array $field) public function getClobTypeDeclarationSQL(array $column)
{ {
if (! empty($field['length']) && is_numeric($field['length'])) { if (! empty($column['length']) && is_numeric($column['length'])) {
$length = $field['length']; $length = $column['length'];
if ($length <= static::LENGTH_LIMIT_TINYTEXT) { if ($length <= static::LENGTH_LIMIT_TINYTEXT) {
return 'TINYTEXT'; return 'TINYTEXT';
...@@ -270,9 +270,9 @@ class MySqlPlatform extends AbstractPlatform ...@@ -270,9 +270,9 @@ class MySqlPlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@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'; return 'TIMESTAMP';
} }
...@@ -282,7 +282,7 @@ class MySqlPlatform extends AbstractPlatform ...@@ -282,7 +282,7 @@ class MySqlPlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDateTypeDeclarationSQL(array $fieldDeclaration) public function getDateTypeDeclarationSQL(array $column)
{ {
return 'DATE'; return 'DATE';
} }
...@@ -290,7 +290,7 @@ class MySqlPlatform extends AbstractPlatform ...@@ -290,7 +290,7 @@ class MySqlPlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getTimeTypeDeclarationSQL(array $fieldDeclaration) public function getTimeTypeDeclarationSQL(array $column)
{ {
return 'TIME'; return 'TIME';
} }
...@@ -298,21 +298,21 @@ class MySqlPlatform extends AbstractPlatform ...@@ -298,21 +298,21 @@ class MySqlPlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBooleanTypeDeclarationSQL(array $field) public function getBooleanTypeDeclarationSQL(array $column)
{ {
return 'TINYINT(1)'; return 'TINYINT(1)';
} }
/** /**
* Obtain DBMS specific SQL code portion needed to set the COLLATION * 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. * @deprecated Deprecated since version 2.5, Use {@link self::getColumnCollationDeclarationSQL()} instead.
* *
* @param string $collation name of the collation * @param string $collation name of the collation
* *
* @return string DBMS specific SQL code portion needed to set 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) public function getCollationFieldDeclaration($collation)
{ {
...@@ -470,14 +470,14 @@ SQL ...@@ -470,14 +470,14 @@ SQL
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getDefaultValueDeclarationSQL($field) public function getDefaultValueDeclarationSQL($column)
{ {
// Unset the default value if the given field definition does not allow default values. // Unset the default value if the given column definition does not allow default values.
if ($field['type'] instanceof TextType || $field['type'] instanceof BlobType) { if ($column['type'] instanceof TextType || $column['type'] instanceof BlobType) {
$field['default'] = null; $column['default'] = null;
} }
return parent::getDefaultValueDeclarationSQL($field); return parent::getDefaultValueDeclarationSQL($column);
} }
/** /**
...@@ -903,41 +903,41 @@ SQL ...@@ -903,41 +903,41 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getIntegerTypeDeclarationSQL(array $field) public function getIntegerTypeDeclarationSQL(array $column)
{ {
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field); return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBigIntTypeDeclarationSQL(array $field) public function getBigIntTypeDeclarationSQL(array $column)
{ {
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getSmallIntTypeDeclarationSQL(array $field) public function getSmallIntTypeDeclarationSQL(array $column)
{ {
return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getFloatDeclarationSQL(array $field) public function getFloatDeclarationSQL(array $column)
{ {
return 'DOUBLE PRECISION' . $this->getUnsignedDeclaration($field); return 'DOUBLE PRECISION' . $this->getUnsignedDeclaration($column);
} }
/** /**
* {@inheritdoc} * {@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 ...@@ -955,14 +955,14 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) protected function _getCommonIntegerTypeDeclarationSQL(array $column)
{ {
$autoinc = ''; $autoinc = '';
if (! empty($columnDef['autoincrement'])) { if (! empty($column['autoincrement'])) {
$autoinc = ' AUTO_INCREMENT'; $autoinc = ' AUTO_INCREMENT';
} }
return $this->getUnsignedDeclaration($columnDef) . $autoinc; return $this->getUnsignedDeclaration($column) . $autoinc;
} }
/** /**
...@@ -1147,10 +1147,10 @@ SQL ...@@ -1147,10 +1147,10 @@ SQL
* *
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBlobTypeDeclarationSQL(array $field) public function getBlobTypeDeclarationSQL(array $column)
{ {
if (! empty($field['length']) && is_numeric($field['length'])) { if (! empty($column['length']) && is_numeric($column['length'])) {
$length = $field['length']; $length = $column['length'];
if ($length <= static::LENGTH_LIMIT_TINYBLOB) { if ($length <= static::LENGTH_LIMIT_TINYBLOB) {
return 'TINYBLOB'; return 'TINYBLOB';
......
...@@ -259,7 +259,7 @@ class OraclePlatform extends AbstractPlatform ...@@ -259,7 +259,7 @@ class OraclePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBooleanTypeDeclarationSQL(array $field) public function getBooleanTypeDeclarationSQL(array $column)
{ {
return 'NUMBER(1)'; return 'NUMBER(1)';
} }
...@@ -267,7 +267,7 @@ class OraclePlatform extends AbstractPlatform ...@@ -267,7 +267,7 @@ class OraclePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getIntegerTypeDeclarationSQL(array $field) public function getIntegerTypeDeclarationSQL(array $column)
{ {
return 'NUMBER(10)'; return 'NUMBER(10)';
} }
...@@ -275,7 +275,7 @@ class OraclePlatform extends AbstractPlatform ...@@ -275,7 +275,7 @@ class OraclePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBigIntTypeDeclarationSQL(array $field) public function getBigIntTypeDeclarationSQL(array $column)
{ {
return 'NUMBER(20)'; return 'NUMBER(20)';
} }
...@@ -283,7 +283,7 @@ class OraclePlatform extends AbstractPlatform ...@@ -283,7 +283,7 @@ class OraclePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getSmallIntTypeDeclarationSQL(array $field) public function getSmallIntTypeDeclarationSQL(array $column)
{ {
return 'NUMBER(5)'; return 'NUMBER(5)';
} }
...@@ -291,7 +291,7 @@ class OraclePlatform extends AbstractPlatform ...@@ -291,7 +291,7 @@ class OraclePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration) public function getDateTimeTypeDeclarationSQL(array $column)
{ {
return 'TIMESTAMP(0)'; return 'TIMESTAMP(0)';
} }
...@@ -299,7 +299,7 @@ class OraclePlatform extends AbstractPlatform ...@@ -299,7 +299,7 @@ class OraclePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration) public function getDateTimeTzTypeDeclarationSQL(array $column)
{ {
return 'TIMESTAMP(0) WITH TIME ZONE'; return 'TIMESTAMP(0) WITH TIME ZONE';
} }
...@@ -307,7 +307,7 @@ class OraclePlatform extends AbstractPlatform ...@@ -307,7 +307,7 @@ class OraclePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDateTypeDeclarationSQL(array $fieldDeclaration) public function getDateTypeDeclarationSQL(array $column)
{ {
return 'DATE'; return 'DATE';
} }
...@@ -315,7 +315,7 @@ class OraclePlatform extends AbstractPlatform ...@@ -315,7 +315,7 @@ class OraclePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getTimeTypeDeclarationSQL(array $fieldDeclaration) public function getTimeTypeDeclarationSQL(array $column)
{ {
return 'DATE'; return 'DATE';
} }
...@@ -323,7 +323,7 @@ class OraclePlatform extends AbstractPlatform ...@@ -323,7 +323,7 @@ class OraclePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) protected function _getCommonIntegerTypeDeclarationSQL(array $column)
{ {
return ''; return '';
} }
...@@ -356,7 +356,7 @@ class OraclePlatform extends AbstractPlatform ...@@ -356,7 +356,7 @@ class OraclePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getClobTypeDeclarationSQL(array $field) public function getClobTypeDeclarationSQL(array $column)
{ {
return 'CLOB'; return 'CLOB';
} }
...@@ -923,26 +923,26 @@ SQL ...@@ -923,26 +923,26 @@ SQL
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getColumnDeclarationSQL($name, array $field) public function getColumnDeclarationSQL($name, array $column)
{ {
if (isset($field['columnDefinition'])) { if (isset($column['columnDefinition'])) {
$columnDef = $this->getCustomTypeDeclarationSQL($field); $columnDef = $this->getCustomTypeDeclarationSQL($column);
} else { } else {
$default = $this->getDefaultValueDeclarationSQL($field); $default = $this->getDefaultValueDeclarationSQL($column);
$notnull = ''; $notnull = '';
if (isset($field['notnull'])) { if (isset($column['notnull'])) {
$notnull = $field['notnull'] ? ' NOT NULL' : ' NULL'; $notnull = $column['notnull'] ? ' NOT NULL' : ' NULL';
} }
$unique = isset($field['unique']) && $field['unique'] ? $unique = isset($column['unique']) && $column['unique'] ?
' ' . $this->getUniqueFieldDeclarationSQL() : ''; ' ' . $this->getUniqueFieldDeclarationSQL() : '';
$check = isset($field['check']) && $field['check'] ? $check = isset($column['check']) && $column['check'] ?
' ' . $field['check'] : ''; ' ' . $column['check'] : '';
$typeDecl = $field['type']->getSQLDeclaration($field, $this); $typeDecl = $column['type']->getSQLDeclaration($column, $this);
$columnDef = $typeDecl . $default . $notnull . $unique . $check; $columnDef = $typeDecl . $default . $notnull . $unique . $check;
} }
...@@ -1205,7 +1205,7 @@ SQL ...@@ -1205,7 +1205,7 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBlobTypeDeclarationSQL(array $field) public function getBlobTypeDeclarationSQL(array $column)
{ {
return 'BLOB'; return 'BLOB';
} }
......
...@@ -14,7 +14,7 @@ class PostgreSQL92Platform extends PostgreSQL91Platform ...@@ -14,7 +14,7 @@ class PostgreSQL92Platform extends PostgreSQL91Platform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getJsonTypeDeclarationSQL(array $field) public function getJsonTypeDeclarationSQL(array $column)
{ {
return 'JSON'; return 'JSON';
} }
...@@ -22,13 +22,13 @@ class PostgreSQL92Platform extends PostgreSQL91Platform ...@@ -22,13 +22,13 @@ class PostgreSQL92Platform extends PostgreSQL91Platform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSmallIntTypeDeclarationSQL(array $field) public function getSmallIntTypeDeclarationSQL(array $column)
{ {
if (! empty($field['autoincrement'])) { if (! empty($column['autoincrement'])) {
return 'SMALLSERIAL'; return 'SMALLSERIAL';
} }
return parent::getSmallIntTypeDeclarationSQL($field); return parent::getSmallIntTypeDeclarationSQL($column);
} }
/** /**
......
...@@ -12,9 +12,9 @@ class PostgreSQL94Platform extends PostgreSQL92Platform ...@@ -12,9 +12,9 @@ class PostgreSQL94Platform extends PostgreSQL92Platform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getJsonTypeDeclarationSQL(array $field) public function getJsonTypeDeclarationSQL(array $column)
{ {
if (! empty($field['jsonb'])) { if (! empty($column['jsonb'])) {
return 'JSONB'; return 'JSONB';
} }
......
...@@ -944,7 +944,7 @@ SQL ...@@ -944,7 +944,7 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBooleanTypeDeclarationSQL(array $field) public function getBooleanTypeDeclarationSQL(array $column)
{ {
return 'BOOLEAN'; return 'BOOLEAN';
} }
...@@ -952,9 +952,9 @@ SQL ...@@ -952,9 +952,9 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getIntegerTypeDeclarationSQL(array $field) public function getIntegerTypeDeclarationSQL(array $column)
{ {
if (! empty($field['autoincrement'])) { if (! empty($column['autoincrement'])) {
return 'SERIAL'; return 'SERIAL';
} }
...@@ -964,9 +964,9 @@ SQL ...@@ -964,9 +964,9 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBigIntTypeDeclarationSQL(array $field) public function getBigIntTypeDeclarationSQL(array $column)
{ {
if (! empty($field['autoincrement'])) { if (! empty($column['autoincrement'])) {
return 'BIGSERIAL'; return 'BIGSERIAL';
} }
...@@ -976,7 +976,7 @@ SQL ...@@ -976,7 +976,7 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getSmallIntTypeDeclarationSQL(array $field) public function getSmallIntTypeDeclarationSQL(array $column)
{ {
return 'SMALLINT'; return 'SMALLINT';
} }
...@@ -984,7 +984,7 @@ SQL ...@@ -984,7 +984,7 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getGuidTypeDeclarationSQL(array $field) public function getGuidTypeDeclarationSQL(array $column)
{ {
return 'UUID'; return 'UUID';
} }
...@@ -992,7 +992,7 @@ SQL ...@@ -992,7 +992,7 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration) public function getDateTimeTypeDeclarationSQL(array $column)
{ {
return 'TIMESTAMP(0) WITHOUT TIME ZONE'; return 'TIMESTAMP(0) WITHOUT TIME ZONE';
} }
...@@ -1000,7 +1000,7 @@ SQL ...@@ -1000,7 +1000,7 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration) public function getDateTimeTzTypeDeclarationSQL(array $column)
{ {
return 'TIMESTAMP(0) WITH TIME ZONE'; return 'TIMESTAMP(0) WITH TIME ZONE';
} }
...@@ -1008,7 +1008,7 @@ SQL ...@@ -1008,7 +1008,7 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDateTypeDeclarationSQL(array $fieldDeclaration) public function getDateTypeDeclarationSQL(array $column)
{ {
return 'DATE'; return 'DATE';
} }
...@@ -1016,7 +1016,7 @@ SQL ...@@ -1016,7 +1016,7 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getTimeTypeDeclarationSQL(array $fieldDeclaration) public function getTimeTypeDeclarationSQL(array $column)
{ {
return 'TIME(0) WITHOUT TIME ZONE'; return 'TIME(0) WITHOUT TIME ZONE';
} }
...@@ -1034,7 +1034,7 @@ SQL ...@@ -1034,7 +1034,7 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) protected function _getCommonIntegerTypeDeclarationSQL(array $column)
{ {
return ''; return '';
} }
...@@ -1059,7 +1059,7 @@ SQL ...@@ -1059,7 +1059,7 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getClobTypeDeclarationSQL(array $field) public function getClobTypeDeclarationSQL(array $column)
{ {
return 'TEXT'; return 'TEXT';
} }
...@@ -1204,7 +1204,7 @@ SQL ...@@ -1204,7 +1204,7 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBlobTypeDeclarationSQL(array $field) public function getBlobTypeDeclarationSQL(array $column)
{ {
return 'BYTEA'; return 'BYTEA';
} }
...@@ -1212,23 +1212,23 @@ SQL ...@@ -1212,23 +1212,23 @@ SQL
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getDefaultValueDeclarationSQL($field) public function getDefaultValueDeclarationSQL($column)
{ {
if ($this->isSerialField($field)) { if ($this->isSerialColumn($column)) {
return ''; 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']) return isset($column['type'], $column['autoincrement'])
&& $field['autoincrement'] === true && $column['autoincrement'] === true
&& $this->isNumericType($field['type']); && $this->isNumericType($column['type']);
} }
/** /**
......
...@@ -42,7 +42,7 @@ class SQLAnywhere12Platform extends SQLAnywhere11Platform ...@@ -42,7 +42,7 @@ class SQLAnywhere12Platform extends SQLAnywhere11Platform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration) public function getDateTimeTzTypeDeclarationSQL(array $column)
{ {
return 'TIMESTAMP WITH TIME ZONE'; return 'TIMESTAMP WITH TIME ZONE';
} }
......
...@@ -298,11 +298,11 @@ class SQLAnywherePlatform extends AbstractPlatform ...@@ -298,11 +298,11 @@ class SQLAnywherePlatform extends AbstractPlatform
/** /**
* {@inheritdoc} * {@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 ...@@ -324,7 +324,7 @@ class SQLAnywherePlatform extends AbstractPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getBlobTypeDeclarationSQL(array $field) public function getBlobTypeDeclarationSQL(array $column)
{ {
return 'LONG BINARY'; return 'LONG BINARY';
} }
...@@ -337,9 +337,9 @@ class SQLAnywherePlatform extends AbstractPlatform ...@@ -337,9 +337,9 @@ class SQLAnywherePlatform extends AbstractPlatform
* Otherwise by just omitting the NOT NULL clause, * Otherwise by just omitting the NOT NULL clause,
* SQL Anywhere will declare them NOT NULL nonetheless. * 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; return 'BIT' . $nullClause;
} }
...@@ -347,7 +347,7 @@ class SQLAnywherePlatform extends AbstractPlatform ...@@ -347,7 +347,7 @@ class SQLAnywherePlatform extends AbstractPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getClobTypeDeclarationSQL(array $field) public function getClobTypeDeclarationSQL(array $column)
{ {
return 'TEXT'; return 'TEXT';
} }
...@@ -499,7 +499,7 @@ class SQLAnywherePlatform extends AbstractPlatform ...@@ -499,7 +499,7 @@ class SQLAnywherePlatform extends AbstractPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration) public function getDateTimeTypeDeclarationSQL(array $column)
{ {
return 'DATETIME'; return 'DATETIME';
} }
...@@ -515,7 +515,7 @@ class SQLAnywherePlatform extends AbstractPlatform ...@@ -515,7 +515,7 @@ class SQLAnywherePlatform extends AbstractPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getDateTypeDeclarationSQL(array $fieldDeclaration) public function getDateTypeDeclarationSQL(array $column)
{ {
return 'DATE'; return 'DATE';
} }
...@@ -678,7 +678,7 @@ class SQLAnywherePlatform extends AbstractPlatform ...@@ -678,7 +678,7 @@ class SQLAnywherePlatform extends AbstractPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getGuidTypeDeclarationSQL(array $field) public function getGuidTypeDeclarationSQL(array $column)
{ {
return 'UNIQUEIDENTIFIER'; return 'UNIQUEIDENTIFIER';
} }
...@@ -695,11 +695,11 @@ class SQLAnywherePlatform extends AbstractPlatform ...@@ -695,11 +695,11 @@ class SQLAnywherePlatform extends AbstractPlatform
/** /**
* {@inheritdoc} * {@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 ...@@ -1039,11 +1039,11 @@ SQL
/** /**
* {@inheritdoc} * {@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 ...@@ -1116,7 +1116,7 @@ SQL
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getTimeTypeDeclarationSQL(array $fieldDeclaration) public function getTimeTypeDeclarationSQL(array $column)
{ {
return 'TIME'; return 'TIME';
} }
...@@ -1236,12 +1236,12 @@ SQL ...@@ -1236,12 +1236,12 @@ SQL
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) protected function _getCommonIntegerTypeDeclarationSQL(array $column)
{ {
$unsigned = ! empty($columnDef['unsigned']) ? 'UNSIGNED ' : ''; $unsigned = ! empty($column['unsigned']) ? 'UNSIGNED ' : '';
$autoincrement = ! empty($columnDef['autoincrement']) ? ' IDENTITY' : ''; $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 ...@@ -29,7 +29,7 @@ class SQLServer2005Platform extends SQLServerPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getClobTypeDeclarationSQL(array $field) public function getClobTypeDeclarationSQL(array $column)
{ {
return 'VARCHAR(MAX)'; return 'VARCHAR(MAX)';
} }
......
...@@ -23,7 +23,7 @@ class SQLServer2008Platform extends SQLServer2005Platform ...@@ -23,7 +23,7 @@ class SQLServer2008Platform extends SQLServer2005Platform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration) public function getDateTimeTypeDeclarationSQL(array $column)
{ {
// 3 - microseconds precision length // 3 - microseconds precision length
// http://msdn.microsoft.com/en-us/library/ms187819.aspx // http://msdn.microsoft.com/en-us/library/ms187819.aspx
...@@ -33,7 +33,7 @@ class SQLServer2008Platform extends SQLServer2005Platform ...@@ -33,7 +33,7 @@ class SQLServer2008Platform extends SQLServer2005Platform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDateTypeDeclarationSQL(array $fieldDeclaration) public function getDateTypeDeclarationSQL(array $column)
{ {
return 'DATE'; return 'DATE';
} }
...@@ -41,7 +41,7 @@ class SQLServer2008Platform extends SQLServer2005Platform ...@@ -41,7 +41,7 @@ class SQLServer2008Platform extends SQLServer2005Platform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getTimeTypeDeclarationSQL(array $fieldDeclaration) public function getTimeTypeDeclarationSQL(array $column)
{ {
return 'TIME(0)'; return 'TIME(0)';
} }
...@@ -49,7 +49,7 @@ class SQLServer2008Platform extends SQLServer2005Platform ...@@ -49,7 +49,7 @@ class SQLServer2008Platform extends SQLServer2005Platform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration) public function getDateTimeTzTypeDeclarationSQL(array $column)
{ {
return 'DATETIMEOFFSET(6)'; return 'DATETIMEOFFSET(6)';
} }
......
...@@ -1161,31 +1161,31 @@ SQL ...@@ -1161,31 +1161,31 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getIntegerTypeDeclarationSQL(array $field) public function getIntegerTypeDeclarationSQL(array $column)
{ {
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field); return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBigIntTypeDeclarationSQL(array $field) public function getBigIntTypeDeclarationSQL(array $column)
{ {
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getSmallIntTypeDeclarationSQL(array $field) public function getSmallIntTypeDeclarationSQL(array $column)
{ {
return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getGuidTypeDeclarationSQL(array $field) public function getGuidTypeDeclarationSQL(array $column)
{ {
return 'UNIQUEIDENTIFIER'; return 'UNIQUEIDENTIFIER';
} }
...@@ -1217,7 +1217,7 @@ SQL ...@@ -1217,7 +1217,7 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getClobTypeDeclarationSQL(array $field) public function getClobTypeDeclarationSQL(array $column)
{ {
return 'VARCHAR(MAX)'; return 'VARCHAR(MAX)';
} }
...@@ -1225,15 +1225,15 @@ SQL ...@@ -1225,15 +1225,15 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) protected function _getCommonIntegerTypeDeclarationSQL(array $column)
{ {
return ! empty($columnDef['autoincrement']) ? ' IDENTITY' : ''; return ! empty($column['autoincrement']) ? ' IDENTITY' : '';
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration) public function getDateTimeTypeDeclarationSQL(array $column)
{ {
return 'DATETIME'; return 'DATETIME';
} }
...@@ -1241,7 +1241,7 @@ SQL ...@@ -1241,7 +1241,7 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDateTypeDeclarationSQL(array $fieldDeclaration) public function getDateTypeDeclarationSQL(array $column)
{ {
return 'DATETIME'; return 'DATETIME';
} }
...@@ -1249,7 +1249,7 @@ SQL ...@@ -1249,7 +1249,7 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getTimeTypeDeclarationSQL(array $fieldDeclaration) public function getTimeTypeDeclarationSQL(array $column)
{ {
return 'DATETIME'; return 'DATETIME';
} }
...@@ -1257,7 +1257,7 @@ SQL ...@@ -1257,7 +1257,7 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBooleanTypeDeclarationSQL(array $field) public function getBooleanTypeDeclarationSQL(array $column)
{ {
return 'BIT'; return 'BIT';
} }
...@@ -1607,7 +1607,7 @@ SQL ...@@ -1607,7 +1607,7 @@ SQL
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBlobTypeDeclarationSQL(array $field) public function getBlobTypeDeclarationSQL(array $column)
{ {
return 'VARBINARY(MAX)'; return 'VARBINARY(MAX)';
} }
...@@ -1617,23 +1617,23 @@ SQL ...@@ -1617,23 +1617,23 @@ SQL
* *
* Modifies column declaration order as it differs in Microsoft SQL Server. * 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'])) { if (isset($column['columnDefinition'])) {
$columnDef = $this->getCustomTypeDeclarationSQL($field); $columnDef = $this->getCustomTypeDeclarationSQL($column);
} else { } else {
$collation = isset($field['collation']) && $field['collation'] ? $collation = isset($column['collation']) && $column['collation'] ?
' ' . $this->getColumnCollationDeclarationSQL($field['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() : ''; ' ' . $this->getUniqueFieldDeclarationSQL() : '';
$check = isset($field['check']) && $field['check'] ? $check = isset($column['check']) && $column['check'] ?
' ' . $field['check'] : ''; ' ' . $column['check'] : '';
$typeDecl = $field['type']->getSQLDeclaration($field, $this); $typeDecl = $column['type']->getSQLDeclaration($column, $this);
$columnDef = $typeDecl . $collation . $notnull . $unique . $check; $columnDef = $typeDecl . $collation . $notnull . $unique . $check;
} }
......
...@@ -201,7 +201,7 @@ class SqlitePlatform extends AbstractPlatform ...@@ -201,7 +201,7 @@ class SqlitePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBooleanTypeDeclarationSQL(array $field) public function getBooleanTypeDeclarationSQL(array $column)
{ {
return 'BOOLEAN'; return 'BOOLEAN';
} }
...@@ -209,71 +209,71 @@ class SqlitePlatform extends AbstractPlatform ...@@ -209,71 +209,71 @@ class SqlitePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getIntegerTypeDeclarationSQL(array $field) public function getIntegerTypeDeclarationSQL(array $column)
{ {
return 'INTEGER' . $this->_getCommonIntegerTypeDeclarationSQL($field); return 'INTEGER' . $this->_getCommonIntegerTypeDeclarationSQL($column);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBigIntTypeDeclarationSQL(array $field) public function getBigIntTypeDeclarationSQL(array $column)
{ {
// SQLite autoincrement is implicit for INTEGER PKs, but not for BIGINT fields. // SQLite autoincrement is implicit for INTEGER PKs, but not for BIGINT columns
if (! empty($field['autoincrement'])) { if (! empty($column['autoincrement'])) {
return $this->getIntegerTypeDeclarationSQL($field); 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 * @return string
*/ */
public function getTinyIntTypeDeclarationSql(array $field) public function getTinyIntTypeDeclarationSql(array $column)
{ {
// SQLite autoincrement is implicit for INTEGER PKs, but not for TINYINT fields. // SQLite autoincrement is implicit for INTEGER PKs, but not for TINYINT columns
if (! empty($field['autoincrement'])) { if (! empty($column['autoincrement'])) {
return $this->getIntegerTypeDeclarationSQL($field); return $this->getIntegerTypeDeclarationSQL($column);
} }
return 'TINYINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); return 'TINYINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getSmallIntTypeDeclarationSQL(array $field) public function getSmallIntTypeDeclarationSQL(array $column)
{ {
// SQLite autoincrement is implicit for INTEGER PKs, but not for SMALLINT fields. // SQLite autoincrement is implicit for INTEGER PKs, but not for SMALLINT columns
if (! empty($field['autoincrement'])) { if (! empty($column['autoincrement'])) {
return $this->getIntegerTypeDeclarationSQL($field); 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 * @return string
*/ */
public function getMediumIntTypeDeclarationSql(array $field) public function getMediumIntTypeDeclarationSql(array $column)
{ {
// SQLite autoincrement is implicit for INTEGER PKs, but not for MEDIUMINT fields. // SQLite autoincrement is implicit for INTEGER PKs, but not for MEDIUMINT columns
if (! empty($field['autoincrement'])) { if (! empty($column['autoincrement'])) {
return $this->getIntegerTypeDeclarationSQL($field); return $this->getIntegerTypeDeclarationSQL($column);
} }
return 'MEDIUMINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); return 'MEDIUMINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration) public function getDateTimeTypeDeclarationSQL(array $column)
{ {
return 'DATETIME'; return 'DATETIME';
} }
...@@ -281,7 +281,7 @@ class SqlitePlatform extends AbstractPlatform ...@@ -281,7 +281,7 @@ class SqlitePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getDateTypeDeclarationSQL(array $fieldDeclaration) public function getDateTypeDeclarationSQL(array $column)
{ {
return 'DATE'; return 'DATE';
} }
...@@ -289,7 +289,7 @@ class SqlitePlatform extends AbstractPlatform ...@@ -289,7 +289,7 @@ class SqlitePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getTimeTypeDeclarationSQL(array $fieldDeclaration) public function getTimeTypeDeclarationSQL(array $column)
{ {
return 'TIME'; return 'TIME';
} }
...@@ -297,14 +297,14 @@ class SqlitePlatform extends AbstractPlatform ...@@ -297,14 +297,14 @@ class SqlitePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) protected function _getCommonIntegerTypeDeclarationSQL(array $column)
{ {
// sqlite autoincrement is only possible for the primary key // sqlite autoincrement is only possible for the primary key
if (! empty($columnDef['autoincrement'])) { if (! empty($column['autoincrement'])) {
return ' PRIMARY KEY AUTOINCREMENT'; return ' PRIMARY KEY AUTOINCREMENT';
} }
return ! empty($columnDef['unsigned']) ? ' UNSIGNED' : ''; return ! empty($column['unsigned']) ? ' UNSIGNED' : '';
} }
/** /**
...@@ -430,7 +430,7 @@ class SqlitePlatform extends AbstractPlatform ...@@ -430,7 +430,7 @@ class SqlitePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getClobTypeDeclarationSQL(array $field) public function getClobTypeDeclarationSQL(array $column)
{ {
return 'CLOB'; return 'CLOB';
} }
...@@ -740,7 +740,7 @@ class SqlitePlatform extends AbstractPlatform ...@@ -740,7 +740,7 @@ class SqlitePlatform extends AbstractPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBlobTypeDeclarationSQL(array $field) public function getBlobTypeDeclarationSQL(array $column)
{ {
return 'BLOB'; return 'BLOB';
} }
...@@ -1013,22 +1013,23 @@ class SqlitePlatform extends AbstractPlatform ...@@ -1013,22 +1013,23 @@ class SqlitePlatform extends AbstractPlatform
continue; continue;
} }
$field = array_merge(['unique' => null, 'autoincrement' => null, 'default' => null], $column->toArray()); $definition = array_merge(['unique' => null, 'autoincrement' => null, 'default' => null], $column->toArray());
$type = $field['type']; $type = $definition['type'];
switch (true) { switch (true) {
case isset($field['columnDefinition']) || $field['autoincrement'] || $field['unique']: case isset($definition['columnDefinition']) || $definition['autoincrement'] || $definition['unique']:
case $type instanceof Types\DateTimeType && $field['default'] === $this->getCurrentTimestampSQL(): case $type instanceof Types\DateTimeType && $definition['default'] === $this->getCurrentTimestampSQL():
case $type instanceof Types\DateType && $field['default'] === $this->getCurrentDateSQL(): case $type instanceof Types\DateType && $definition['default'] === $this->getCurrentDateSQL():
case $type instanceof Types\TimeType && $field['default'] === $this->getCurrentTimeSQL(): case $type instanceof Types\TimeType && $definition['default'] === $this->getCurrentTimeSQL():
return false; return false;
} }
$field['name'] = $column->getQuotedName($this); $definition['name'] = $column->getQuotedName($this);
if ($type instanceof Types\StringType && $field['length'] === null) { if ($type instanceof Types\StringType && $definition['length'] === null) {
$field['length'] = 255; $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)) { if (! $this->onSchemaAlterTable($diff, $tableSql)) {
......
...@@ -209,7 +209,7 @@ class ExpressionBuilder ...@@ -209,7 +209,7 @@ class ExpressionBuilder
/** /**
* Creates an IS NULL expression with the given arguments. * 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 * @return string
*/ */
...@@ -221,7 +221,7 @@ class ExpressionBuilder ...@@ -221,7 +221,7 @@ class ExpressionBuilder
/** /**
* Creates an IS NOT NULL expression with the given arguments. * 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 * @return string
*/ */
...@@ -274,7 +274,7 @@ class ExpressionBuilder ...@@ -274,7 +274,7 @@ class ExpressionBuilder
/** /**
* Creates a NOT IN () comparison expression with the given arguments. * 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. * @param string|string[] $y The placeholder or the array of values to be used by NOT IN() comparison.
* *
* @return string * @return string
......
...@@ -145,7 +145,7 @@ abstract class AbstractSchemaManager ...@@ -145,7 +145,7 @@ abstract class AbstractSchemaManager
* Lists the columns for a given table. * Lists the columns for a given table.
* *
* In contrast to other libraries and to the old version of Doctrine, * 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 * the reason that it is not portable across different RDBMS. Use
* {@see listTableIndexes($tableName)} to retrieve the primary key * {@see listTableIndexes($tableName)} to retrieve the primary key
* of a table. Where a RDBMS specifies more details, these are held * of a table. Where a RDBMS specifies more details, these are held
......
...@@ -199,7 +199,7 @@ class Comparator ...@@ -199,7 +199,7 @@ class Comparator
$table1Columns = $table1->getColumns(); $table1Columns = $table1->getColumns();
$table2Columns = $table2->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) { foreach ($table2Columns as $columnName => $column) {
if ($table1->hasColumn($columnName)) { if ($table1->hasColumn($columnName)) {
continue; continue;
...@@ -209,7 +209,7 @@ class Comparator ...@@ -209,7 +209,7 @@ class Comparator
$changes++; $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) { foreach ($table1Columns as $columnName => $column) {
// See if column is removed in table 2. // See if column is removed in table 2.
if (! $table2->hasColumn($columnName)) { if (! $table2->hasColumn($columnName)) {
...@@ -414,7 +414,7 @@ class Comparator ...@@ -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 * If there are differences this method returns $field2, otherwise the
* boolean false. * boolean false.
......
...@@ -16,21 +16,21 @@ class TableDiff ...@@ -16,21 +16,21 @@ class TableDiff
public $newName = false; public $newName = false;
/** /**
* All added fields. * All added columns
* *
* @var Column[] * @var Column[]
*/ */
public $addedColumns; public $addedColumns;
/** /**
* All changed fields. * All changed columns
* *
* @var ColumnDiff[] * @var ColumnDiff[]
*/ */
public $changedColumns = []; public $changedColumns = [];
/** /**
* All removed fields. * All removed columns
* *
* @var Column[] * @var Column[]
*/ */
......
...@@ -19,9 +19,9 @@ class ArrayType extends Type ...@@ -19,9 +19,9 @@ class ArrayType extends Type
/** /**
* {@inheritdoc} * {@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 ...@@ -21,9 +21,9 @@ class BigIntType extends Type implements PhpIntegerMappingType
/** /**
* {@inheritdoc} * {@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 ...@@ -20,9 +20,9 @@ class BinaryType extends Type
/** /**
* {@inheritdoc} * {@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 ...@@ -20,9 +20,9 @@ class BlobType extends Type
/** /**
* {@inheritdoc} * {@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 ...@@ -13,9 +13,9 @@ class BooleanType extends Type
/** /**
* {@inheritdoc} * {@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 ...@@ -26,11 +26,11 @@ class DateIntervalType extends Type
/** /**
* {@inheritdoc} * {@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 ...@@ -24,9 +24,9 @@ class DateTimeType extends Type implements PhpDateTimeMappingType
/** /**
* {@inheritdoc} * {@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 ...@@ -35,9 +35,9 @@ class DateTimeTzType extends Type implements PhpDateTimeMappingType
/** /**
* {@inheritdoc} * {@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 ...@@ -22,9 +22,9 @@ class DateType extends Type
/** /**
* {@inheritdoc} * {@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 ...@@ -20,9 +20,9 @@ class DecimalType extends Type
/** /**
* {@inheritdoc} * {@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 ...@@ -17,9 +17,9 @@ class FloatType extends Type
/** /**
* {@inheritdoc} * {@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 ...@@ -12,9 +12,9 @@ class GuidType extends StringType
/** /**
* {@inheritdoc} * {@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 ...@@ -21,9 +21,9 @@ class IntegerType extends Type implements PhpIntegerMappingType
/** /**
* {@inheritdoc} * {@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 ...@@ -21,9 +21,9 @@ class JsonType extends Type
/** /**
* {@inheritdoc} * {@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 ...@@ -19,9 +19,9 @@ class ObjectType extends Type
/** /**
* {@inheritdoc} * {@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 ...@@ -19,9 +19,9 @@ class SimpleArrayType extends Type
/** /**
* {@inheritdoc} * {@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 ...@@ -21,9 +21,9 @@ class SmallIntType extends Type implements PhpIntegerMappingType
/** /**
* {@inheritdoc} * {@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 ...@@ -12,9 +12,9 @@ class StringType extends Type
/** /**
* {@inheritdoc} * {@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 ...@@ -15,9 +15,9 @@ class TextType extends Type
/** /**
* {@inheritdoc} * {@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 ...@@ -22,9 +22,9 @@ class TimeType extends Type
/** /**
* {@inheritdoc} * {@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 ...@@ -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. * @param AbstractPlatform $platform The currently used database platform.
* *
* @return string * @return string
*/ */
abstract public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform); abstract public function getSQLDeclaration(array $column, AbstractPlatform $platform);
/** /**
* Gets the name of this type. * Gets the name of this type.
......
...@@ -28,8 +28,8 @@ class BlobTest extends DbalFunctionalTestCase ...@@ -28,8 +28,8 @@ class BlobTest extends DbalFunctionalTestCase
$table = new Table('blob_table'); $table = new Table('blob_table');
$table->addColumn('id', 'integer'); $table->addColumn('id', 'integer');
$table->addColumn('clobfield', 'text'); $table->addColumn('clobcolumn', 'text');
$table->addColumn('blobfield', 'blob'); $table->addColumn('blobcolumn', 'blob');
$table->setPrimaryKey(['id']); $table->setPrimaryKey(['id']);
$sm = $this->connection->getSchemaManager(); $sm = $this->connection->getSchemaManager();
...@@ -40,8 +40,8 @@ class BlobTest extends DbalFunctionalTestCase ...@@ -40,8 +40,8 @@ class BlobTest extends DbalFunctionalTestCase
{ {
$ret = $this->connection->insert('blob_table', [ $ret = $this->connection->insert('blob_table', [
'id' => 1, 'id' => 1,
'clobfield' => 'test', 'clobcolumn' => 'test',
'blobfield' => 'test', 'blobcolumn' => 'test',
], [ ], [
ParameterType::INTEGER, ParameterType::INTEGER,
ParameterType::STRING, ParameterType::STRING,
...@@ -61,8 +61,8 @@ class BlobTest extends DbalFunctionalTestCase ...@@ -61,8 +61,8 @@ class BlobTest extends DbalFunctionalTestCase
$longBlob = str_repeat('x', 4 * 8192); // send 4 chunks $longBlob = str_repeat('x', 4 * 8192); // send 4 chunks
$this->connection->insert('blob_table', [ $this->connection->insert('blob_table', [
'id' => 1, 'id' => 1,
'clobfield' => 'ignored', 'clobcolumn' => 'ignored',
'blobfield' => fopen('data://text/plain,' . $longBlob, 'r'), 'blobcolumn' => fopen('data://text/plain,' . $longBlob, 'r'),
], [ ], [
ParameterType::INTEGER, ParameterType::INTEGER,
ParameterType::STRING, ParameterType::STRING,
...@@ -76,8 +76,8 @@ class BlobTest extends DbalFunctionalTestCase ...@@ -76,8 +76,8 @@ class BlobTest extends DbalFunctionalTestCase
{ {
$this->connection->insert('blob_table', [ $this->connection->insert('blob_table', [
'id' => 1, 'id' => 1,
'clobfield' => 'test', 'clobcolumn' => 'test',
'blobfield' => 'test', 'blobcolumn' => 'test',
], [ ], [
ParameterType::INTEGER, ParameterType::INTEGER,
ParameterType::STRING, ParameterType::STRING,
...@@ -91,15 +91,15 @@ class BlobTest extends DbalFunctionalTestCase ...@@ -91,15 +91,15 @@ class BlobTest extends DbalFunctionalTestCase
{ {
$this->connection->insert('blob_table', [ $this->connection->insert('blob_table', [
'id' => 1, 'id' => 1,
'clobfield' => 'test', 'clobcolumn' => 'test',
'blobfield' => 'test', 'blobcolumn' => 'test',
], [ ], [
ParameterType::INTEGER, ParameterType::INTEGER,
ParameterType::STRING, ParameterType::STRING,
ParameterType::LARGE_OBJECT, 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::LARGE_OBJECT,
ParameterType::INTEGER, ParameterType::INTEGER,
]); ]);
...@@ -116,8 +116,8 @@ class BlobTest extends DbalFunctionalTestCase ...@@ -116,8 +116,8 @@ class BlobTest extends DbalFunctionalTestCase
$this->connection->insert('blob_table', [ $this->connection->insert('blob_table', [
'id' => 1, 'id' => 1,
'clobfield' => 'ignored', 'clobcolumn' => 'ignored',
'blobfield' => 'test', 'blobcolumn' => 'test',
], [ ], [
ParameterType::INTEGER, ParameterType::INTEGER,
ParameterType::STRING, ParameterType::STRING,
...@@ -126,7 +126,7 @@ class BlobTest extends DbalFunctionalTestCase ...@@ -126,7 +126,7 @@ class BlobTest extends DbalFunctionalTestCase
$this->connection->update('blob_table', [ $this->connection->update('blob_table', [
'id' => 1, 'id' => 1,
'blobfield' => fopen('data://text/plain,test2', 'r'), 'blobcolumn' => fopen('data://text/plain,test2', 'r'),
], ['id' => 1], [ ], ['id' => 1], [
ParameterType::INTEGER, ParameterType::INTEGER,
ParameterType::LARGE_OBJECT, ParameterType::LARGE_OBJECT,
...@@ -141,7 +141,7 @@ class BlobTest extends DbalFunctionalTestCase ...@@ -141,7 +141,7 @@ class BlobTest extends DbalFunctionalTestCase
$this->markTestIncomplete('The oci8 driver does not support stream resources as parameters'); $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; $stream = null;
$stmt->bindParam(1, $stream, ParameterType::LARGE_OBJECT); $stmt->bindParam(1, $stream, ParameterType::LARGE_OBJECT);
...@@ -156,7 +156,7 @@ class BlobTest extends DbalFunctionalTestCase ...@@ -156,7 +156,7 @@ class BlobTest extends DbalFunctionalTestCase
private function assertBlobContains(string $text): void 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); self::assertCount(1, $rows);
......
...@@ -236,7 +236,7 @@ class ExceptionTest extends DbalFunctionalTestCase ...@@ -236,7 +236,7 @@ class ExceptionTest extends DbalFunctionalTestCase
{ {
$schema = new Schema(); $schema = new Schema();
$table = $schema->createTable('bad_fieldname_table'); $table = $schema->createTable('bad_columnname_table');
$table->addColumn('id', 'integer', []); $table->addColumn('id', 'integer', []);
foreach ($schema->toSql($this->connection->getDatabasePlatform()) as $sql) { foreach ($schema->toSql($this->connection->getDatabasePlatform()) as $sql) {
...@@ -244,7 +244,7 @@ class ExceptionTest extends DbalFunctionalTestCase ...@@ -244,7 +244,7 @@ class ExceptionTest extends DbalFunctionalTestCase
} }
$this->expectException(Exception\InvalidFieldNameException::class); $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 public function testNonUniqueFieldNameException(): void
...@@ -270,7 +270,7 @@ class ExceptionTest extends DbalFunctionalTestCase ...@@ -270,7 +270,7 @@ class ExceptionTest extends DbalFunctionalTestCase
{ {
$schema = new Schema(); $schema = new Schema();
$table = $schema->createTable('unique_field_table'); $table = $schema->createTable('unique_column_table');
$table->addColumn('id', 'integer'); $table->addColumn('id', 'integer');
$table->addUniqueIndex(['id']); $table->addUniqueIndex(['id']);
...@@ -278,9 +278,9 @@ class ExceptionTest extends DbalFunctionalTestCase ...@@ -278,9 +278,9 @@ class ExceptionTest extends DbalFunctionalTestCase
$this->connection->exec($sql); $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->expectException(Exception\UniqueConstraintViolationException::class);
$this->connection->insert('unique_field_table', ['id' => 5]); $this->connection->insert('unique_column_table', ['id' => 5]);
} }
public function testSyntaxErrorException(): void public function testSyntaxErrorException(): void
......
...@@ -138,13 +138,12 @@ class PortabilityTest extends DbalFunctionalTestCase ...@@ -138,13 +138,12 @@ class PortabilityTest extends DbalFunctionalTestCase
* *
* @dataProvider fetchAllColumnProvider * @dataProvider fetchAllColumnProvider
*/ */
public function testFetchAllColumn(string $field, array $expected): void public function testFetchAllColumn(string $column, array $expected): void
{ {
$conn = $this->getPortableConnection(); $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, $stmt->fetchAll(FetchMode::COLUMN));
self::assertEquals($expected, $column);
} }
/** /**
......
...@@ -516,7 +516,7 @@ class MoneyType extends Type ...@@ -516,7 +516,7 @@ class MoneyType extends Type
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{ {
return 'MyMoney'; return 'MyMoney';
} }
......
...@@ -350,8 +350,10 @@ abstract class AbstractPlatformTestCase extends DbalTestCase ...@@ -350,8 +350,10 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
public function testGetCustomColumnDeclarationSql(): void public function testGetCustomColumnDeclarationSql(): void
{ {
$field = ['columnDefinition' => 'MEDIUMINT(6) UNSIGNED']; self::assertEquals(
self::assertEquals('foo MEDIUMINT(6) UNSIGNED', $this->platform->getColumnDeclarationSQL('foo', $field)); 'foo MEDIUMINT(6) UNSIGNED',
$this->platform->getColumnDeclarationSQL('foo', ['columnDefinition' => 'MEDIUMINT(6) UNSIGNED'])
);
} }
public function testGetCreateTableSqlDispatchEvent(): void public function testGetCreateTableSqlDispatchEvent(): void
...@@ -516,26 +518,22 @@ abstract class AbstractPlatformTestCase extends DbalTestCase ...@@ -516,26 +518,22 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
public function testGetDefaultValueDeclarationSQL(): void public function testGetDefaultValueDeclarationSQL(): void
{ {
// non-timestamp value will get single quotes // non-timestamp value will get single quotes
$field = [ self::assertEquals(" DEFAULT 'non_timestamp'", $this->platform->getDefaultValueDeclarationSQL([
'type' => Type::getType('string'), 'type' => Type::getType('string'),
'default' => 'non_timestamp', 'default' => 'non_timestamp',
]; ]));
self::assertEquals(" DEFAULT 'non_timestamp'", $this->platform->getDefaultValueDeclarationSQL($field));
} }
public function testGetDefaultValueDeclarationSQLDateTime(): void public function testGetDefaultValueDeclarationSQLDateTime(): void
{ {
// timestamps on datetime types should not be quoted // timestamps on datetime types should not be quoted
foreach (['datetime', 'datetimetz', 'datetime_immutable', 'datetimetz_immutable'] as $type) { foreach (['datetime', 'datetimetz', 'datetime_immutable', 'datetimetz_immutable'] as $type) {
$field = [
'type' => Type::getType($type),
'default' => $this->platform->getCurrentTimestampSQL(),
];
self::assertSame( self::assertSame(
' DEFAULT ' . $this->platform->getCurrentTimestampSQL(), ' 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 ...@@ -543,14 +541,12 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
public function testGetDefaultValueDeclarationSQLForIntegerTypes(): void public function testGetDefaultValueDeclarationSQLForIntegerTypes(): void
{ {
foreach (['bigint', 'integer', 'smallint'] as $type) { foreach (['bigint', 'integer', 'smallint'] as $type) {
$field = [
'type' => Type::getType($type),
'default' => 1,
];
self::assertEquals( self::assertEquals(
' DEFAULT 1', ' DEFAULT 1',
$this->platform->getDefaultValueDeclarationSQL($field) $this->platform->getDefaultValueDeclarationSQL([
'type' => Type::getType($type),
'default' => 1,
])
); );
} }
} }
...@@ -559,14 +555,12 @@ abstract class AbstractPlatformTestCase extends DbalTestCase ...@@ -559,14 +555,12 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
{ {
$currentDateSql = $this->platform->getCurrentDateSQL(); $currentDateSql = $this->platform->getCurrentDateSQL();
foreach (['date', 'date_immutable'] as $type) { foreach (['date', 'date_immutable'] as $type) {
$field = [
'type' => Type::getType($type),
'default' => $currentDateSql,
];
self::assertSame( self::assertSame(
' DEFAULT ' . $currentDateSql, ' DEFAULT ' . $currentDateSql,
$this->platform->getDefaultValueDeclarationSQL($field) $this->platform->getDefaultValueDeclarationSQL([
'type' => Type::getType($type),
'default' => $currentDateSql,
])
); );
} }
} }
......
...@@ -469,10 +469,10 @@ abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCas ...@@ -469,10 +469,10 @@ abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCas
public function testModifyLimitSubquerySimple(): void public function testModifyLimitSubquerySimple(): void
{ {
$querySql = 'SELECT DISTINCT id_0 FROM ' $querySql = 'SELECT DISTINCT id_0 FROM '
. '(SELECT k0_.id AS id_0, k0_.field AS field_1 ' . '(SELECT k0_.id AS id_0, k0_.column AS column_1 '
. 'FROM key_table k0_ WHERE (k0_.where_field IN (1))) dctrn_result'; . '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_.field AS field_1 ' $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_field IN (1))) dctrn_result'; . 'FROM key_table k0_ WHERE (k0_.where_column IN (1))) dctrn_result';
$sql = $this->platform->modifyLimitQuery($querySql, 20); $sql = $this->platform->modifyLimitQuery($querySql, 20);
$this->expectCteWithMaxRowNum($alteredSql, 20, $sql); $this->expectCteWithMaxRowNum($alteredSql, 20, $sql);
} }
...@@ -1445,14 +1445,12 @@ abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCas ...@@ -1445,14 +1445,12 @@ abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCas
{ {
$currentDateSql = $this->platform->getCurrentDateSQL(); $currentDateSql = $this->platform->getCurrentDateSQL();
foreach (['date', 'date_immutable'] as $type) { foreach (['date', 'date_immutable'] as $type) {
$field = [
'type' => Type::getType($type),
'default' => $currentDateSql,
];
self::assertSame( self::assertSame(
' DEFAULT CONVERT(date, GETDATE())', ' 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 ...@@ -326,10 +326,10 @@ class SQLServer2012PlatformTest extends AbstractSQLServerPlatformTestCase
public function testModifyLimitSubquerySimple(): void public function testModifyLimitSubquerySimple(): void
{ {
$querySql = 'SELECT DISTINCT id_0 FROM ' $querySql = 'SELECT DISTINCT id_0 FROM '
. '(SELECT k0_.id AS id_0, k0_.field AS field_1 ' . '(SELECT k0_.id AS id_0, k0_.column AS column_1 '
. 'FROM key_table k0_ WHERE (k0_.where_field IN (1))) dctrn_result'; . '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_.field AS field_1 ' $alteredSql = 'SELECT DISTINCT id_0 FROM (SELECT k0_.id AS id_0, k0_.column AS column_1 '
. 'FROM key_table k0_ WHERE (k0_.where_field IN (1))) dctrn_result ORDER BY 1 OFFSET 0 ROWS FETCH NEXT 20 ROWS ONLY'; . '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); $sql = $this->platform->modifyLimitQuery($querySql, 20);
self::assertEquals($alteredSql, $sql); self::assertEquals($alteredSql, $sql);
} }
......
...@@ -58,10 +58,10 @@ class SQLParserUtilsTest extends DbalTestCase ...@@ -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 [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']], // Ticket GH-2295
['SELECT * FROM foo WHERE jsonb_exists_any(foo.bar, array[:foo])', false, [56 => 'foo']], ['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.column1, ARRAY[\'3\'] FROM schema.table table WHERE table.f1 = :foo AND ARRAY[\'3\']', false, [74 => 'foo']],
['SELECT table.field1, ARRAY[\'3\']::integer[] FROM schema.table table WHERE table.f1 = :foo AND ARRAY[\'3\']::integer[]', false, [84 => 'foo']], ['SELECT table.column1, ARRAY[\'3\']::integer[] FROM schema.table table WHERE table.f1 = :foo AND ARRAY[\'3\']::integer[]', false, [85 => 'foo']],
['SELECT table.field1, ARRAY[:foo] FROM schema.table table WHERE table.f1 = :bar AND ARRAY[\'3\']', false, [27 => 'foo', 74 => 'bar']], ['SELECT table.column1, ARRAY[:foo] FROM schema.table table WHERE table.f1 = :bar AND ARRAY[\'3\']', false, [28 => 'foo', 75 => '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[:foo]::integer[] FROM schema.table table WHERE table.f1 = :bar AND ARRAY[\'3\']::integer[]', false, [28 => 'foo', 86 => 'bar']],
[ [
<<<'SQLDATA' <<<'SQLDATA'
SELECT * FROM foo WHERE SELECT * FROM foo WHERE
......
...@@ -20,7 +20,7 @@ class CommentedType extends Type ...@@ -20,7 +20,7 @@ class CommentedType extends Type
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{ {
return strtoupper($this->getName()); return strtoupper($this->getName());
} }
......
...@@ -20,7 +20,7 @@ class MySqlPointType extends Type ...@@ -20,7 +20,7 @@ class MySqlPointType extends Type
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{ {
return strtoupper($this->getName()); 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