The andX()
and orX()
methods of the ExpressionBuilder
class have been removed. Use and()
and or()
instead.
The add()
and addMultiple()
methods of the CompositeExpression
class have been removed. Use with()
instead, which returns a new instance.
The CompositeExpression
class is now immutable.
- The
select()
,addSelect()
,groupBy()
andaddGroupBy()
methods no longer accept an array of arguments. Pass each expression as an individual argument or expand an array of expressions using the...
operator. - The
select()
,addSelect()
,groupBy()
andaddGroupBy()
methods no longer ignore the first argument if it's empty. - The
addSelect()
method can be no longer called without arguments. - The
insert()
,update()
anddelete()
methods now require the$table
parameter, and do not support aliases anymore. - The
add()
,getQueryPart()
,getQueryParts()
,resetQueryPart()
andresetQueryParts()
methods are removed. - For a
select()
query, thegetSQL()
method now throws an expression if noSELECT
expressions have been provided.
The OCI8Statement::convertPositionalToNamedPlaceholders()
method has been extracted to an internal utility class.
The statement implementations no longer detect whether $params
is a zero- or one-based array. A zero-based numeric array is expected.
The ServerInfoAwareConnection::requiresQueryForServerVersion()
method has been removed as an implementation detail which is the same for almost all supported drivers.
All implementations of the PingableConnection
and ServerInfoAwareConnection
interfaces have to implement the methods defined in the Connection
interface as well.
All implementations of the VersionAwarePlatformDriver
interface have to implement the methods defined in the Driver
interface as well.
DBAL now requires PostgeSQL 9.4 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to newer PostgreSQL version (9.6+ is recommended).
Doctrine\DBAL\Platforms\PostgreSqlPlatform
and Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords
now represent the PostgreSQL 9.4.
The following classes have been removed:
Doctrine\DBAL\Platforms\PostgreSQL94Platform
Doctrine\DBAL\Platforms\Keywords\PostgreSQL94Keywords
DBAL now requires MariaDB 10.1 or newer, support for unmaintained versions has been dropped. If you are using any of the legacy versions, you have to upgrade to newer MariaDB version (10.1+ is recommended).
- The
Doctrine\DBAL\Driver::getDatabase()
method has been removed. Please useDoctrine\DBAL\Connection::getDatabase()
instead. Doctrine\DBAL\Connection::getDatabase()
will always return the name of the database currently connected to, regardless of the configuration parameters and will initialize a database connection if it's not yet established.- A call to
Doctrine\DBAL\Connection::getDatabase()
, when connected to an SQLite database, will no longer return the database file path.
- When generating schema DDL, DBAL no longer provides the default length for string and binary columns. The application may need to provide the column length if required by the target platform.
- The
\DBAL\Platforms\AbstractPlatform::getVarcharTypeDeclarationSQL()
method has been renamed to::getStringTypeDeclarationSQL()
. - The following
AbstractPlatform
methods have been removed as no longer relevant:::getCharMaxLength()
,::getVarcharMaxLength()
,::getVarcharDefaultLength()
,::getBinaryMaxLength()
,::getBinaryDefaultLength()
.
Table columns are no longer indexed by column name. Use the name
attribute of the column instead.
- Class constant
SQLSrvStatement::LAST_INSERT_ID_SQL
was changed from public to private. - Class
Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser
was made final. - Class
Doctrine\DBAL\Sharding\SQLAzure\Schema\MultiTenantVisitor
was made final. - Class
Doctrine\DBAL\Sharding\SQLAzure\SQLAzureFederationsSynchronizer
was made final. - Class
Doctrine\DBAL\Sharding\PoolingShardManager
was made final. - Class
Doctrine\DBAL\Id\TableGeneratorSchemaVisitor
was made final. - Class
Doctrine\DBAL\Driver\Mysqli\Driver
was made final. - Class
Doctrine\DBAL\Driver\Mysqli\MysqliStatement
was made final. - Class
Doctrine\DBAL\Driver\OCI8\Driver
was made final. - Class
Doctrine\DBAL\Driver\OCI8\OCI8Connection
was made final. - Class
Doctrine\DBAL\Driver\OCI8\OCI8Statement
was made final. - Class
Doctrine\DBAL\Driver\PDOSqlsrv\Driver
was made final. - Class
Doctrine\DBAL\Driver\PDOSqlsrv\Statement
was made final. - Class
Doctrine\DBAL\Driver\PDOMySql\Driver
was made final. - Class
Doctrine\DBAL\Driver\IBMDB2\DB2Connection
was made final. - Class
Doctrine\DBAL\Driver\IBMDB2\DB2Statement
was made final. - Class
Doctrine\DBAL\Driver\IBMDB2\DB2Driver
was made final. - Class
Doctrine\DBAL\Driver\SQLSrv\SQLSrvStatement
was made final. - Class
Doctrine\DBAL\Driver\SQLSrv\Driver
was made final. - Class
Doctrine\DBAL\Driver\SQLSrv\SQLSrvConnection
was made final. - Class
Doctrine\DBAL\Driver\SQLAnywhere\SQLAnywhereConnection
was made final. - Class
Doctrine\DBAL\Driver\SQLAnywhere\Driver
was made final. - Class
Doctrine\DBAL\Driver\SQLAnywhere\SQLAnywhereStatement
was made final. - Class
Doctrine\DBAL\Driver\PDOPgSql\Driver
was made final. - Class
Doctrine\DBAL\Driver\PDOOracle\Driver
was made final. - Class
Doctrine\DBAL\Driver\PDOSqlite\Driver
was made final. - Class
Doctrine\DBAL\Driver\StatementIterator
was made final. - Class
Doctrine\DBAL\Cache\ResultCacheStatement
was made final. - Class
Doctrine\DBAL\Cache\ArrayStatement
was made final. - Class
Doctrine\DBAL\Schema\Synchronizer\SingleDatabaseSynchronizer
was made final. - Class
Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets
was made final. - Class
Doctrine\DBAL\Portability\Statement
was made final.
- Column precision no longer defaults to 10. The default value is NULL.
- Asset names are no longer nullable. An empty asset name should be represented as an empty string.
Doctrine\DBAL\Schema\AbstractSchemaManager::_getPortableTriggersList()
and::_getPortableTriggerDefinition()
have been removed.
SchemaAlterTableAddColumnEventArgs::addSql()
and the same method in otherSchemaEventArgs
-based classes no longer accept an array of SQL statements. They accept a variadic string.ConnectionEventArgs::getDriver()
,::getDatabasePlatform()
and::getSchemaManager()
methods have been removed. The connection information can be obtained from the connection which is available via::getConnection()
.SchemaColumnDefinitionEventArgs::getDatabasePlatform()
andSchemaIndexDefinitionEventArgs::getDatabasePlatform()
have been removed for the same reason as above.
- The following methods have been removed as leaking internal implementation details:
::getHost()
,::getPort()
,::getUsername()
,::getPassword()
. - The
::getDatabase()
method can now return null which means that no database is currently selected. - The
::project()
method has been removed. Use::executeQuery()
and fetch the data from the statement using one of theStatement::fetch*()
methods instead.
- The class stores the last inserted ID as a nullable string, not an integer, which is reflected in the method signatures.
- Method
Doctrine\DBAL\Schema\AbstractSchemaManager::_getPortableViewDefinition()
no longer optionally returns false. It will always return aDoctrine\DBAL\Schema\View
instance. - Method
Doctrine\DBAL\Schema\Comparator::diffTable()
now optionally returns null instead of false. - Property
Doctrine\DBAL\Schema\Table::$_primaryKeyName
is now optionally null instead of false. - Property
Doctrine\DBAL\Schema\TableDiff::$newName
is now optionally null instead of false. - Method
Doctrine\DBAL\Schema\AbstractSchemaManager::tablesExist()
no longer accepts a string. UseDoctrine\DBAL\Schema\AbstractSchemaManager::tableExists()
instead. - Method
Doctrine\DBAL\Schema\OracleSchemaManager::createDatabase()
no longer acceptsnull
for$database
argument. - Removed unused method
Doctrine\DBAL\Schema\AbstractSchemaManager::_getPortableFunctionsList()
- Removed unused method
Doctrine\DBAL\Schema\AbstractSchemaManager::_getPortableFunctionDefinition()
- Removed unused method
Doctrine\DBAL\Schema\OracleSchemaManager::_getPortableFunctionDefinition()
- Removed unused method
Doctrine\DBAL\Schema\SqliteSchemaManager::_getPortableTableIndexDefinition()
- The
$username
and$password
arguments of::connect()
are no longer nullable. Use an empty string to indicate empty username or password. - The return value of
::getDatabase()
has been documented as nullable since some of the drivers allow establishing a connection without selecting a database.
The Doctrine\DBAL\Driver::getName()
has been removed.
- Removed
json_array
type and all associated hacks. - Removed
Connection::TRANSACTION_*
constants. - Removed
AbstractPlatform::DATE_INTERVAL_UNIT_*
andAbstractPlatform::TRIM_*
constants. - Removed
MysqlSessionInit
listener. - Removed
MysqlPlatform::getCollationFieldDeclaration()
. - Removed
AbstractPlatform::getIdentityColumnNullInsertSQL()
. - Removed
Table::addUnnamedForeignKeyConstraint()
andTable::addNamedForeignKeyConstraint()
. - Removed
Table::renameColumn()
. - Removed
SQLParserUtils::getPlaceholderPositions()
. - Removed
LoggerChain::addLogger
. - Removed
AbstractSchemaManager::getFilterSchemaAssetsExpression()
,Configuration::getFilterSchemaAssetsExpression()
andConfiguration::getFilterSchemaAssetsExpression()
. SQLParserUtils::*_TOKEN
constants made private.
Connection::ping()
and PingableConnection::ping()
no longer return a boolean value. They will throw an exception in case of failure.
PostgreSqlPlatform::getAdvancedForeignKeyOptionsSQL()
had a typo in it in 2.x. Both the option name
feferred
and deferred
were supported in 2.x
but the misspelling was removed in 3.x.
BC BREAK AbstractSchemaManager::extractDoctrineTypeFromComment()
changed, ::removeDoctrineTypeFromComment()
removed
AbstractSchemaManager::extractDoctrineTypeFromComment()
made protected
. It takes the comment by reference, removes the type annotation from it and returns the extracted Doctrine type.
The error information is available in DriverException
trown in case of an error.
- The
Doctrine\DBAL\Driver\DriverException::getErrorCode()
method is removed. In order to obtain the driver error code, please use::getCode()
. Doctrine\DBAL\Driver\PDOException
no longer extendsPDOException
.- The value returned by
Doctrine\DBAL\Driver\PDOException::getSQLState()
no longer falls back to the driver error code.
The method was used internally and is no longer needed.
The method was used internally and is no longer needed.
The following methods' arguments do not longer accept integer value:
- the
$expression
argument in::getCountExpression()
, - the
$decimals
argument in::getRoundExpression()
, - the
$seconds
argument in::getDateAddSecondsExpression()
, - the
$seconds
argument in::getDateSubSecondsExpression()
, - the
$minutes
argument in::getDateAddMinutesExpression()
, - the
$minutes
argument in::getDateSubMinutesExpression()
, - the
$hours
argument in::getDateAddHourExpression()
, - the
$hours
argument in::getDateAddHourExpression()
, - the
$days
argument in::getDateAddDaysExpression()
, - the
$days
argument in::getDateSubDaysExpression()
, - the
$weeks
argument in::getDateAddWeeksExpression()
, - the
$weeks
argument in::getDateSubWeeksExpression()
, - the
$months
argument in::getDateAddMonthExpression()
, - the
$months
argument in::getDateSubMonthExpression()
, - the
$quarters
argument in::getDateAddQuartersExpression()
, - the
$quarters
argument in::getDateSubQuartersExpression()
, - the
$years
argument in::getDateAddYearsExpression()
, - the
$years
argument in::getDateSubYearsExpression()
.
Please use the strings representing numeric SQL literals instead (e.g. '1'
instead of 1
).
The signature of AbstractPlatform::getConcatExpression()
changed to ::getConcatExpression(string ...$string)
.
BC BREAK The type of $start
in AbstractPlatform::getLocateExpression()
changed from string|false
to ?string
The default value of $start
is now null
, not false
.
BC BREAK The types of $start
and $length
in AbstractPlatform::getSubstringExpression()
changed from int
and ?int
to string
and ?string
respectively
The platform abstraction allows building arbitrary SQL expressions, so even if the arguments represent numeric literals, they should be passed as a string.
BC BREAK The type of $char
in AbstractPlatform::getTrimExpression()
changed from string|false
to ?string
The default value of $char
is now null
, not false
. Additionally, the method will throw an InvalidArgumentException
in an invalid value of $mode
is passed.
Statement::quote()
and ExpressionBuilder::literal()
no longer accept arguments of an arbitrary type and and don't implement type-specific handling. Only strings can be quoted.
Connection::connect()
, Statement::bindParam()
, ::bindValue()
, ::execute()
, ResultStatement::setFetchMode()
and ::closeCursor()
no longer return a boolean value. They will throw an exception in case of failure.
Statement::rowCount()
has been moved to the ResultStatement
interface where it belongs by definition.
Statement::beginTransaction()
, ::commit()
and ::rollBack()
no longer return a boolean value. They will throw a DriverException
in case of failure.
Similarly to PDOStatement::fetchColumn()
, DBAL statements throw an exception in case of an invalid column index.
Similarly to the drivers based on pdo_pgsql
and pdo_sqlsrv
, OCI8Statement::execute()
and MySQLiStatement::execute()
do not longer ignore redundant parameters.
The Doctrine\DBAL\Types\Type::getDefaultLength()
method has been removed as it served no purpose.
Relying on string representation was discouraged and has been removed.
The NULL
value of the $offset
argument in AbstractPlatform::(do)?ModifyLimitQuery()
methods is no longer allowed. The absence of the offset should be indicated with a 0
which is now the default value.
The support for DB-generated UUIDs was removed as non-portable. Please generate UUIDs on the application side (e.g. using ramsey/uuid).
The Doctrine\DBAL\Platforms\MsSQLKeywords
has been removed.
Please use Doctrine\DBAL\Platforms\SQLServerPlatform
instead.
This PDO-based IBM DB2 driver (built on top of pdo_ibm extension) has already been unsupported as of 2.5, it has now been now removed.
The following class has been removed:
Doctrine\DBAL\Driver\PDOIbm\Driver
DBAL now requires SQL Anywhere 16 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to newer SQL Anywhere version (16+).
Doctrine\DBAL\Platforms\SQLAnywherePlatform
and Doctrine\DBAL\Platforms\Keywords\SQLAnywhereKeywords
now represent the SQL Anywhere 16.
The following classes have been removed:
Doctrine\DBAL\Platforms\SQLAnywhere11Platform
Doctrine\DBAL\Platforms\SQLAnywhere12Platform
Doctrine\DBAL\Platforms\SQLAnywhere16Platform
Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords
Doctrine\DBAL\Platforms\Keywords\SQLAnywhere12Keywords
Doctrine\DBAL\Platforms\Keywords\SQLAnywhere16Keywords
DBAL now requires SQL Server 2012 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to newer SQL Server version.
Doctrine\DBAL\Platforms\SQLServerPlatform
and Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords
now represent the SQL Server 2012.
The following classes have been removed:
Doctrine\DBAL\Platforms\SQLServer2005Platform
Doctrine\DBAL\Platforms\SQLServer2008Platform
Doctrine\DBAL\Platforms\SQLServer2012Platform
Doctrine\DBAL\Platforms\Keywords\SQLServer2005Keywords
Doctrine\DBAL\Platforms\Keywords\SQLServer2008Keywords
Doctrine\DBAL\Platforms\Keywords\SQLServer2012Keywords
The AbstractSQLServerDriver
class and its subclasses no longer implement the VersionAwarePlatformDriver
interface.
DBAL now requires PostgeSQL 9.3 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to newer PostgreSQL version (9.6+ is recommended).
Doctrine\DBAL\Platforms\PostgreSqlPlatform
and Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords
now represent the PostgreSQL 9.3.
The following classes have been removed:
Doctrine\DBAL\Platforms\PostgreSQL91Platform
Doctrine\DBAL\Platforms\PostgreSQL92Platform
Doctrine\DBAL\Platforms\Keywords\PostgreSQL91Keywords
Doctrine\DBAL\Platforms\Keywords\PostgreSQL92Keywords
The Doctrine\DBAL\Version class is no longer available: please refrain from checking the DBAL version at runtime.
The Drizzle project is abandoned and is therefore not supported by Doctrine DBAL anymore.
- The
SQLLogger
interface has changed; the methods are the same but use scalar type hints, return types, and non-nullable arrays. SQLLogger
implementations:DebugStack
,EchoSQLLogger
,LoggerChain
are now final.Configuration::getSQLLogger()
does not returnnull
anymore, but aNullLogger
implementation.Configuration::setSQLLogger()
does not allownull
anymore.
- Binary fields whose length exceeds the maximum field size on a given platform are no longer represented as
BLOB
s. Use binary fields of a size which fits all target platforms, or use blob explicitly instead. - Binary fields are no longer represented as streams in PHP. They are represented as strings.
The Doctrine\DBAL\Version
class is no longer available: please refrain from checking the DBAL version at runtime.
In order to share the same PDO
instances between DBAL and other components, initialize the connection in DBAL and access it using Connection::getWrappedConnection()->getWrappedConnection()
.
- The support of
PDO::PARAM_*
,PDO::FETCH_*
,PDO::CASE_*
andPDO::PARAM_INPUT_OUTPUT
constants in the DBAL API is removed. \Doctrine\DBAL\Driver\PDOConnection
does not extend\PDO
anymore. Please use\Doctrine\DBAL\Driver\PDOConnection::getWrappedConnection()
to access the underlyingPDO
object.\Doctrine\DBAL\Driver\PDOStatement
does not extend\PDOStatement
anymore.
Before:
use Doctrine\DBAL\Portability\Connection;
$params = array(
'wrapperClass' => Connection::class,
'fetch_case' => PDO::CASE_LOWER,
);
$stmt->bindValue(1, 1, PDO::PARAM_INT);
$stmt->fetchAll(PDO::FETCH_COLUMN);
After:
use Doctrine\DBAL\ColumnCase;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Portability\Connection;
$params = array(
'wrapperClass' => Connection::class,
'fetch_case' => ColumnCase::LOWER,
);
$stmt->bindValue(1, 1, ParameterType::INTEGER);
$stmt->fetchAll(FetchMode::COLUMN);
The dbal:import
CLI command has been removed since it only worked with PDO-based drivers by relying on a non-documented behavior of the extension, and it was impossible to make it work with other drivers.
Please use other database client applications for import, e.g.:
- For MySQL and MariaDB:
mysql [dbname] < data.sql
. - For PostgreSQL:
psql [dbname] < data.sql
. - For SQLite:
sqlite3 /path/to/file.db < data.sql
.
The usage of the Doctrine\DBAL\Version
class is deprecated as internal implementation detail. Please refrain from checking the DBAL version at runtime.
The usage of the andX()
and orX()
methods of the ExpressionBuilder
class has been deprecated. Use and()
and or()
instead.
- The usage of the
add()
andaddMultiple()
methods of theCompositeExpression
class has been deprecated. Usewith()
instead, which returns a new instance. In the future, theadd*()
methods will be removed and the class will be effectively immutable. - The usage of the
CompositeExpression
constructor has been deprecated. Use theand()
/or()
factory methods.
Calling the select()
, addSelect()
, groupBy()
and addGroupBy()
methods with an array argument is deprecated.
The usage of the getDriver()
, getDatabasePlatform()
and getSchemaManager()
methods of the ConnectionEventArgs
class has been deprecated. Obtain the underlying connection via getConnection()
and call the corresponding methods on the connection instance.
The usage of the getDatabasePlatform()
method of the SchemaColumnDefinitionEventArgs
class has been deprecated. Obtain the underlying connection via getConnection()
and call the corresponding method on the connection instance.
The usage of the getHost()
, getPort()
, getUsername()
and getPassword()
methods of the Connection
class has been deprecated as they leak implementation details.
Passing multiple SQL statements as an array to SchemaAlterTableAddColumnEventArgs::addSql()
and the same method in other SchemaEventArgs
-based classes is deprecated. Pass each statement as an individual argument instead.
Instead of passing a string, pass a one-element array.
In order to create a database, always pass the database name.
The following methods have been deprecated as unused:
AbstractSchemaManager::_getPortableFunctionsList()
,AbstractSchemaManager::_getPortableFunctionDefinition()
,OracleSchemaManager::_getPortableFunctionDefinition()
,SqliteSchemaManager::_getPortableTableIndexDefinition()
.
- The usage of NULL to indicate empty
$username
or$password
when callingconnect()
is deprecated. Use an empty string instead.
Method Doctrine\DBAL\Platforms::_getAlterTableIndexForeignKeySQL()
has been deprecated as no longer used.
Property Doctrine\DBAL\Driver\OCI8\OCI8Statement::$_PARAM
has been deprecated as not used.
Relying on the name of the driver is discouraged. For referencing the driver, use its class name.
The usage of user-provided PDO
instance is deprecated. The known use cases are:
- Persistent PDO connections. DBAL 3.0 will supported establishing persistent connections, therefore, providing a pre-created persistent PDO connection will be no longer needed.
- Sharing
PDO
instance between DBAL and legacy components. In order to share a PDO instance, initialize the connection in DBAL and access it usingConnection::getWrappedConnection()->getWrappedConnection()
.
They are converted to SQL literals (e.g. escaped). Clients must now specify default values in their initial form, not in the form of an SQL literal (e.g. escaped).
Before:
$column->setDefault('Foo\\\\Bar\\\\Baz');
After:
$column->setDefault('Foo\\Bar\\Baz');
The constants for built-in types have been moved from Doctrine\DBAL\Types\Type
to a separate class Doctrine\DBAL\Types\Types
.
Some of the constants were renamed in the process:
TARRAY
->ARRAY
DATE
->DATE_MUTABLE
DATETIME
->DATETIME_MUTABLE
DATETIMETZ
->DATETIMETZ_MUTABLE
TIME
->TIME_MUTABLE
The Doctrine\DBAL\Driver\SQLSrv\SQLSrvStatement::LAST_INSERT_ID_SQL
constant has been deprecated and will be made private in 3.0.
The constants in Doctrine\DBAL\SQLParserUtils
have been deprecated and will be made private in 3.0.
The Doctrine\DBAL\Logging\LoggerChain::addLogger
method has been deprecated. Inject list of loggers via constructor instead.
Calls to Statement::fetchColumn()
with an invalid column index currently return NULL
. In the future, such calls will result in a exception.
Deprecated Configuration::getFilterSchemaAssetsExpression()
, ::setFilterSchemaAssetsExpression()
and AbstractSchemaManager::getFilterSchemaAssetsExpression()
.
Regular expression-based filters are hard to extend by combining together. Instead, you may use callback-based filers via ::getSchemaAssetsFilter()
and ::getSchemaAssetsFilter()
. Callbacks can use regular expressions internally.
This method was never used by DBAL internally. It is now deprecated and will be removed in DBAL 3.0.
Relying on string representation is discouraged and will be removed in DBAL 3.0.
The NULL
value of the $offset
argument in AbstractPlatform::(do)?ModifyLimitQuery()
methods is deprecated. If explicitly used in the method call, the absence of the offset should be indicated with a 0
.
The dbal:import
CLI command has been deprecated since it only works with PDO-based drivers by relying on a non-documented behavior of the extension, and it's impossible to make it work with other drivers.
Please use other database client applications for import, e.g.:
- For MySQL and MariaDB:
mysql [dbname] < data.sql
. - For PostgreSQL:
psql [dbname] < data.sql
. - For SQLite:
sqlite3 /path/to/file.db < data.sql
.
The format of DB-generated UUIDs is inconsistent across supported platforms and therefore is not portable. Some of the platforms produce UUIDv1, some produce UUIDv4, some produce the values which are not even UUID.
Unless UUIDs are used in stored procedures which DBAL doesn't support, there's no real benefit of DB-generated UUIDs comparing to the application-generated ones.
Use a PHP library (e.g. ramsey/uuid) to generate UUIDs on the application side.
- The usage of binary fields whose length exceeds the maximum field size on a given platform is deprecated. Use binary fields of a size which fits all target platforms, or use blob explicitly instead.
The dependency on doctrine/common package has been removed. DBAL now depends on doctrine/cache and doctrine/event-manager instead. If you are using any other component from doctrine/common package, you will have to add an explicit dependency to your composer.json.
Corrected exception thrown by Doctrine\DBAL\Platforms\SQLAnywhere16Platform::getAdvancedIndexOptionsSQL()
This method now throws SPL UnexpectedValueException
instead of accidentally throwing Doctrine\Common\Proxy\Exception\UnexpectedValueException
.
Doctrine\DBAL\Platforms\AbstractPlatform::DATE_INTERVAL_UNIT_*
constants were moved into Doctrine\DBAL\Platforms\DateIntervalUnit
class without the DATE_INTERVAL_UNIT_
prefix.
Doctrine\DBAL\Platforms\AbstractPlatform::TRIM_*
constants were moved into Doctrine\DBAL\Platforms\TrimMode
class without the TRIM_
prefix.
Doctrine\DBAL\Connection::TRANSACTION_*
were moved into Doctrine\DBAL\TransactionIsolationLevel
class without the TRANSACTION_
prefix.
- When calling
Doctrine\DBAL\Driver\Statement
methods, instead ofPDO::PARAM_*
constants,Doctrine\DBAL\ParameterType
constants should be used. - When calling
Doctrine\DBAL\Driver\ResultStatement
methods, instead ofPDO::FETCH_*
constants,Doctrine\DBAL\FetchMode
constants should be used. - When configuring
Doctrine\DBAL\Portability\Connection
, instead ofPDO::CASE_*
constants,Doctrine\DBAL\ColumnCase
constants should be used. - Usage of
PDO::PARAM_INPUT_OUTPUT
inDoctrine\DBAL\Driver\Statement::bindValue()
is deprecated. - Usage of
PDO::FETCH_FUNC
inDoctrine\DBAL\Driver\ResultStatement::fetch()
is deprecated. - Calls to
\PDOStatement
methods on a\Doctrine\DBAL\Driver\PDOStatement
instance (e.g.fetchObject()
) are deprecated.
Doctrine\DBAL\Driver\ResultStatement::fetch()
now has 3 arguments instead of 1, respectingPDO::fetch()
signature.
Before:
Doctrine\DBAL\Driver\ResultStatement::fetch($fetchMode);
After:
Doctrine\DBAL\Driver\ResultStatement::fetch($fetchMode, $cursorOrientation, $cursorOffset);
Doctrine\DBAL\Driver\ResultStatement::fetchAll()
now has 3 arguments instead of 1, respectingPDO::fetchAll()
signature.
Before:
Doctrine\DBAL\Driver\ResultStatement::fetchAll($fetchMode);
After:
Doctrine\DBAL\Driver\ResultStatement::fetch($fetchMode, $fetchArgument, $ctorArgs);
URL-style DSNs (e.g. mysql://foo@bar:localhost/db
) are now assumed to be percent-encoded
in order to allow certain special characters in usernames, paswords and database names. If
you are using a URL-style DSN and have a username, password or database name containing a
percentage sign, you need to update your DSN. If your password is, say, foo%foo
, it
should be encoded as foo%25foo
.
When adding indexes to Doctrine\DBAL\Schema\Table
via addIndex()
or addUniqueIndex()
,
duplicate indexes are not silently ignored/dropped anymore (based on semantics, not naming!).
Duplicate indexes are considered indexes that pass isFullfilledBy()
or overrules()
in Doctrine\DBAL\Schema\Index
.
This is required to make the index renaming feature introduced in 2.5.0 work properly and avoid
issues in the ORM schema tool / DBAL schema manager which pretends users from updating
their schemas and migrate to DBAL 2.5.*.
Additionally it offers more flexibility in declaring indexes for the user and potentially fixes
related issues in the ORM.
With this change, the responsibility to decide which index is a "duplicate" is completely deferred
to the user.
Please also note that adding foreign key constraints to a table via addForeignKeyConstraint()
,
addUnnamedForeignKeyConstraint()
or addNamedForeignKeyConstraint()
now first checks if an
appropriate index is already present and avoids adding an additional auto-generated one eventually.
When mapping time
type field to PHP's DateTime
instance all unused date fields are
reset to UNIX epoch (i.e. 1970-01-01). This might break any logic which relies on comparing
DateTime
instances with date fields set to the current date.
Use !
format prefix (see http://php.net/manual/en/datetime.createfromformat.php) for parsing
time strings to prevent having different date fields when comparing user input and DateTime
instances as mapped by Doctrine.
The methods addIndex()
and addUniqueIndex()
in Doctrine\DBAL\Schema\Table
have an additional, optional parameter. If you override these methods, you should
add this new parameter to the declaration of your overridden methods.
The visibility of the property $_platform
in Doctrine\DBAL\Connection
was changed from protected to private. If you have subclassed Doctrine\DBAL\Connection
in your application and accessed $_platform
directly, you have to change the code
portions to use getDatabasePlatform()
instead to retrieve the underlying database
platform.
The reason for this change is the new automatic platform version detection feature,
which lazily evaluates the appropriate platform class to use for the underlying database
server version at runtime.
Please also note, that calling getDatabasePlatform()
now needs to establish a connection
in order to evaluate the appropriate platform class if Doctrine\DBAL\Connection
is not
already connected. Under the following circumstances, it is not possible anymore to retrieve
the platform instance from the connection object without having to do a real connect:
Doctrine\DBAL\Connection
was instantiated without theplatform
connection parameter.Doctrine\DBAL\Connection
was instantiated without theserverVersion
connection parameter.- The underlying driver is "version aware" and can provide different platform instances for different versions.
- The underlying driver connection is "version aware" and can provide the database server version without having to query for it.
If one of the above conditions is NOT met, there is no need for Doctrine\DBAL\Connection
to do a connect when calling getDatabasePlatform()
.
Before 2.5 the DateTime type always required a specific format, defined in
$platform->getDateTimeFormatString()
, which could cause quite some troubles
on platforms that had various microtime precision formats. Starting with 2.5
whenever the parsing of a date fails with the predefined platform format,
the date_create()
function will be used to parse the date.
This could cause some troubles when your date format is weird and not parsed
correctly by date_create
, however since databases are rather strict on dates
there should be no problem.
The pdo_ibm
driver is buggy and does not work well with Doctrine. Therefore it will no
longer be supported and has been removed from the Doctrine\DBAL\DriverManager
drivers
map. It is highly encouraged to to use ibm_db2
driver instead if you want to connect
to an IBM DB2 database as it is much more stable and secure.
If for some reason you have to utilize the pdo_ibm
driver you can still use the driverClass
connection parameter to explicitly specify the Doctrine\DBAL\Driver\PDOIbm\Driver
class.
However be aware that you are doing this at your own risk and it will not be guaranteed that
Doctrine will work as expected.
If you have custom classes that implement the constraint interface, you have to implement
an additional method getQuotedColumns
now. This method is used to build proper constraint
SQL for columns that need to be quoted, like keywords reserved by the specific platform used.
The method has to return the same values as getColumns
only that those column names that
need quotation have to be returned quoted for the given platform.
Before 2.3 the Oracle Session Init did not care about the numeric character of the Session. This could lead to problems on non english locale systems that required a comma as a floating point seperator in Oracle. Since 2.3, using the Oracle Session Init on connection start the client session will be altered to set the numeric character to ".,":
ALTER SESSION SET NLS_NUMERIC_CHARACTERS = '.,'
See DBAL-345 for more details.
The query related methods including but not limited to executeQuery, exec, query, and executeUpdate now wrap the driver exceptions such as PDOException with DBALException to add more debugging information such as the executed SQL statement, and any bound parameters.
If you want to retrieve the driver specific exception, you can retrieve it by calling the
getPrevious()
method on DBALException.
Before:
catch(\PDOException $ex) {
// ...
}
After:
catch(\Doctrine\DBAL\DBALException $ex) {
$pdoException = $ex->getPrevious();
// ...
}
This method only worked on MySQL and it is considered unsafe on MySQL to use SET NAMES UTF-8 instead of setting the charset directly on connection already. Replace this behavior with the connection charset option:
Before:
$conn = DriverManager::getConnection(array(..));
$conn->setCharset('UTF8');
After:
$conn = DriverManager::getConnection(array('charset' => 'UTF8', ..));
Doctrine\DBAL\Schema\Table#renameColumn() was removed, because it drops and recreates the column instead. There is no fix available, because a schema diff cannot reliably detect if a column was renamed or one column was created and another one dropped.
You should use explicit SQL ALTER TABLE statements to change columns names.
The Filter Schema assets expression is not wrapped in () anymore for the regexp automatically.
Before:
$config->setFilterSchemaAssetsExpression('foo');
After:
$config->setFilterSchemaAssetsExpression('(foo)');
If you are creating a new MySQL Table through the Doctrine API, charset/collate are now set to 'utf8'/'utf8_unicode_ci' by default. Previously the MySQL server defaults were used.
Both methods now accept an optional last parameter $types with binding types of the values passed. This can potentially break child classes that have overwritten one of these methods.
Doctrine\DBAL\Connection#executeQuery() got a new last parameter "QueryCacheProfile $qcp"
The Driver statement was split into a ResultStatement and the normal statement extending from it. This separates the configuration and the retrieval API from a statement.
The MsSqlPlatform was renamed to SQLServerPlatform, the MsSqlSchemaManager was renamed to SQLServerSchemaManager.
DBAL 2.1 and before were actually only compatible to SQL Server 2008, not earlier versions. Still other parts of the platform did use old features instead of newly introduced datatypes in SQL Server 2005. Starting with DBAL 2.2 you can pick the Doctrine abstraction exactly matching your SQL Server version.
The PDO SqlSrv driver now uses the new SQLServer2008Platform
as default platform.
This platform uses new features of SQL Server as of version 2008. This also includes a switch
in the used fields for "text" and "blob" field types to:
"text" => "VARCHAR(MAX)"
"blob" => "VARBINARY(MAX)"
Additionally SQLServerPlatform
in DBAL 2.1 and before used "DATE", "TIME" and "DATETIME2" for dates.
This types are only available since version 2008 and the introduction of an explicit
SQLServer 2008 platform makes this dependency explicit.
An SQLServer2005Platform
was also introduced to differentiate the features between
versions 2003, earlier and 2005.
With this change the SQLServerPlatform
now throws an exception for using limit queries
with an offset, since SQLServer 2003 and lower do not support this feature.
To use the old SQL Server Platform, because you are using SQL Server 2003 and below use the following configuration code:
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Platforms\SQLServer2005Platform;
// You are using SQL Server 2003 or earlier
$conn = DriverManager::getConnection(array(
'driver' => 'pdo_sqlsrv',
'platform' => new SQLServerPlatform()
// .. additional parameters
));
// You are using SQL Server 2005
$conn = DriverManager::getConnection(array(
'driver' => 'pdo_sqlsrv',
'platform' => new SQLServer2005Platform()
// .. additional parameters
));
// You are using SQL Server 2008
$conn = DriverManager::getConnection(array(
'driver' => 'pdo_sqlsrv',
// 2008 is default platform
// .. additional parameters
));