Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
84328cd
Replace andX/orX with and/or
BenMorel Jan 27, 2020
130e158
Merge pull request #3851 from BenMorel/andx
morozov Jan 28, 2020
4566a9b
First parameter of ExpressionBuilder::and/or() mandatory
BenMorel Jan 28, 2020
ad4f12b
Merge pull request #3852 from BenMorel/and-or-mandatory
morozov Jan 28, 2020
20324a4
Add CompositeExpression::with(), deprecate add*()
BenMorel Jan 27, 2020
ce9b49c
Merge pull request #3850 from BenMorel/immutable
morozov Jan 28, 2020
ebfe185
Deprecate calling QueryBuilder methods with an array argument
BenMorel Jan 28, 2020
ae76ccc
Merge pull request #3853 from BenMorel/deprecations
morozov Jan 28, 2020
1d0ebf0
Deprecated the usage of the Version class
morozov Jan 30, 2020
1d50325
CompositeExpression and()/or() factory methods
BenMorel Jan 30, 2020
9b2db8d
Merge pull request #3861 from morozov/deprecate-version
morozov Jan 30, 2020
f9a0563
Merge pull request #3864 from BenMorel/2.11-nonempty-compositeexpression
morozov Jan 30, 2020
e82ad5d
Merge branch '2.10.x' into 2.11.x
morozov Mar 16, 2020
3de9903
Bump version to 2.11.0-DEV
morozov Mar 16, 2020
3b0e942
Merge pull request #3898 from morozov/2.11.0-dev
greg0ire Mar 17, 2020
853d1cf
Deprecate the usage of the legacy platforms and drivers
morozov Mar 18, 2020
9dcb41e
Merge pull request #3905 from morozov/issues/3855
greg0ire Mar 18, 2020
cb81e40
Removed performance tests
morozov Mar 28, 2020
fcf472a
Actualize the content of the .gitattributes file
morozov Mar 28, 2020
715b589
Merge pull request #3923 from morozov/remove-performance-tests
morozov Mar 28, 2020
cfd1c02
Merge pull request #3924 from morozov/actualize-gitattributes
morozov Mar 28, 2020
32aac3b
Added missing parameter types to CompositeExpression::(and|or)()
morozov Mar 30, 2020
239d3fb
Merge branch '2.10.x' into 2.11.x
morozov Mar 30, 2020
f185ba4
Deprecate EchoSQLLogger
morozov Apr 7, 2020
156d774
Merge pull request #3935 from morozov/deprecate-echo-sql-logger
morozov Apr 7, 2020
0bb2e66
Merge branch '2.10.x' into 2.11.x
morozov Apr 11, 2020
c774923
Merge remote-tracking branch 'origin/2.10.x' into 2.11.x
greg0ire Apr 14, 2020
50927b6
Merge remote-tracking branch 'origin/2.10.x' into 2.11.x
greg0ire Apr 19, 2020
d3205dc
Merge branch '2.11.x' into 2.10.x-merge-up-into-2.11.x_5e9de30c262e49…
morozov Apr 20, 2020
eeed374
Merge pull request #3968 from doctrine/2.10.x-merge-up-into-2.11.x_5e…
morozov Apr 20, 2020
b3131f8
Merge remote-tracking branch 'origin/2.10.x' into 2.11.x
greg0ire Apr 21, 2020
0a2e2f1
Merge remote-tracking branch 'origin/2.10.x' into 2.11.x
greg0ire May 4, 2020
a8544ca
Merge remote-tracking branch 'origin/2.10.x' into 2.11.x
greg0ire May 7, 2020
b10d4db
allow using multiple connections for CLI commands
dmaicher Apr 15, 2020
62201f9
Merge pull request #3956 from dmaicher/cli_multi_connection
morozov May 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
/.appveyor.yml export-ignore
/composer.lock export-ignore
/docs export-ignore
/.doctrine-project.json export-ignore
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/build.properties export-ignore
/build.xml export-ignore
/composer.lock export-ignore
/docs export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/run-all.sh export-ignore
/.scrutinizer.yml export-ignore
/SECURITY.md export-ignore
/tests export-ignore
/.travis.yml export-ignore
/UPGRADE.md export-ignore
42 changes: 42 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
# Upgrade to 2.11

## Deprecated `EchoSQLLogger`

The `EchoSQLLogger` is has been deprecated. Implement your logger with the desired logic.

## Deprecated database platforms:

1. PostgreSQL 9.3 and older
2. MariaDB 10.0 and older
3. SQL Server 2008 and older
4. SQL Anywhere 12 and older
5. Drizzle
6. Azure SQL Database

## Deprecated database drivers:

1. PDO-based IBM DB2 driver
2. Drizzle MySQL driver

## Deprecated `Doctrine\DBAL\Sharding` package

The sharding functionality in DBAL has been effectively unmaintained for a long time.

## Deprecated `Doctrine\DBAL\Version` class

The usage of the `Doctrine\DBAL\Version` class is deprecated as internal implementation detail. Please refrain from checking the DBAL version at runtime.

## Deprecated `ExpressionBuilder` methods

The usage of the `andX()` and `orX()` methods of the `ExpressionBuilder` class has been deprecated. Use `and()` and `or()` instead.

## Deprecated `CompositeExpression` methods

- The usage of the `add()` and `addMultiple()` methods of the `CompositeExpression` class has been deprecated. Use `with()` instead, which returns a new instance.
In the future, the `add*()` methods will be removed and the class will be effectively immutable.
- The usage of the `CompositeExpression` constructor has been deprecated. Use the `and()` / `or()` factory methods.

## Deprecated calling `QueryBuilder` methods with an array argument

Calling the `select()`, `addSelect()`, `groupBy()` and `addGroupBy()` methods with an array argument is deprecated.

# Upgrade to 2.10

## Deprecated `Doctrine\DBAL\Event\ConnectionEventArgs` methods
Expand Down
15 changes: 8 additions & 7 deletions bin/doctrine-dbal.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use Doctrine\DBAL\Tools\Console\ConnectionProvider;
use Doctrine\DBAL\Tools\Console\ConsoleRunner;
use Symfony\Component\Console\Helper\HelperSet;

Expand Down Expand Up @@ -41,17 +42,17 @@
exit(1);
}

$commands = [];
$helperSet = require $configFile;
$commands = [];
$helperSetOrConnectionProvider = require $configFile;

if (! $helperSet instanceof HelperSet) {
foreach ($GLOBALS as $helperSetCandidate) {
if ($helperSetCandidate instanceof HelperSet) {
$helperSet = $helperSetCandidate;
if (! $helperSetOrConnectionProvider instanceof HelperSet && ! $helperSetOrConnectionProvider instanceof ConnectionProvider) {
foreach ($GLOBALS as $candidate) {
if ($candidate instanceof HelperSet) {
$helperSetOrConnectionProvider = $candidate;

break;
}
}
}

ConsoleRunner::run($helperSet, $commands);
ConsoleRunner::run($helperSetOrConnectionProvider, $commands);
21 changes: 10 additions & 11 deletions docs/en/reference/platforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,25 @@ Oracle
Microsoft SQL Server
^^^^^^^^^^^^^^^^^^^^

- ``SQLServerPlatform`` for version 2000 and above.
- ``SQLServer2005Platform`` for version 2005 and above.
- ``SQLServer2008Platform`` for version 2008 and above.
- ``SQLServerPlatform`` for version 2000 and above (deprecated).
- ``SQLServer2005Platform`` for version 2005 and above (deprecated).
- ``SQLServer2008Platform`` for version 2008 and above (deprecated).
- ``SQLServer2012Platform`` for version 2012 and above.

PostgreSQL
^^^^^^^^^^

- ``PostgreSqlPlatform`` for all versions.
- ``PostgreSQL91Platform`` for version 9.1 and above.
- ``PostgreSQL92Platform`` for version 9.2 and above.
- ``PostgreSqlPlatform`` for version 9.0 and below (deprecated).
- ``PostgreSQL91Platform`` for version 9.1 and above (deprecated).
- ``PostgreSQL92Platform`` for version 9.2 and above (deprecated).
- ``PostgreSQL94Platform`` for version 9.4 and above.

SAP Sybase SQL Anywhere
^^^^^^^^^^^^^^^^^^^^^^^

- ``SQLAnywherePlatform`` for version 10 and above.
- ``SQLAnywhere11Platform`` for version 11 and above.
- ``SQLAnywhere12Platform`` for version 12 and above.
- ``SQLAnywherePlatform`` for version 10 and above (deprecated).
- ``SQLAnywhere11Platform`` for version 11 and above (deprecated).
- ``SQLAnywhere12Platform`` for version 12 and above (deprecated).
- ``SQLAnywhere16Platform`` for version 16 and above.

SQLite
Expand All @@ -79,7 +79,7 @@ SQLite
Drizzle
^^^^^^

- ``DrizzlePlatform`` for all versions.
- ``DrizzlePlatform`` for all versions (deprecated).

It is highly encouraged to use the platform class that matches your
database vendor and version best. Otherwise it is not guaranteed
Expand Down Expand Up @@ -113,4 +113,3 @@ all the different database vendors, for example MySQL BIGINT and
Oracle NUMBER should be handled as integer. Doctrine 2 offers a
powerful way to abstract the database to php and back conversion,
which is described in the next section.

4 changes: 2 additions & 2 deletions docs/en/reference/query-builder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,13 @@ Most notably you can use expressions to build nested And-/Or statements:
->select('id', 'name')
->from('users')
->where(
$queryBuilder->expr()->andX(
$queryBuilder->expr()->and(
$queryBuilder->expr()->eq('username', '?'),
$queryBuilder->expr()->eq('email', '?')
)
);

The ``andX()`` and ``orX()`` methods accept an arbitrary amount
The ``and()`` and ``or()`` methods accept an arbitrary amount
of arguments and can be nested in each other.

There is a bunch of methods to create comparisons and other SQL snippets
Expand Down
3 changes: 3 additions & 0 deletions lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\ParameterType;

/**
* @deprecated
*/
class Connection extends PDOConnection
{
/**
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

/**
* Drizzle driver using PDO MySql.
*
* @deprecated
*/
class Driver extends \Doctrine\DBAL\Driver\PDOMySql\Driver
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

/**
* Driver for the PDO IBM extension.
*
* @deprecated Use the driver based on the ibm_db2 extension instead.
*/
class Driver extends AbstractDB2Driver
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Logging/EchoSQLLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

/**
* A SQL logger that logs to the standard output using echo/var_dump.
*
* @deprecated
*/
class EchoSQLLogger implements SQLLogger
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

/**
* Drizzle platform
*
* @deprecated
*/
class DrizzlePlatform extends AbstractPlatform
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Platforms/PostgreSQL91Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.1 database platform.
*
* @deprecated Use PostgreSQL 9.4 or newer
*/
class PostgreSQL91Platform extends PostgreSqlPlatform
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Platforms/PostgreSQL92Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.2 database platform.
*
* @deprecated Use PostgreSQL 9.4 or newer
*/
class PostgreSQL92Platform extends PostgreSQL91Platform
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
/**
* PostgreSqlPlatform.
*
* @deprecated Use PostgreSQL 9.4 or newer
*
* @todo Rename: PostgreSQLPlatform
*/
class PostgreSqlPlatform extends AbstractPlatform
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Platforms/SQLAnywhere11Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/**
* The SQLAnywhere11Platform provides the behavior, features and SQL dialect of the
* SAP Sybase SQL Anywhere 11 database platform.
*
* @deprecated Use SQLAnywhere 16 or newer
*/
class SQLAnywhere11Platform extends SQLAnywherePlatform
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Platforms/SQLAnywhere12Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/**
* The SQLAnywhere12Platform provides the behavior, features and SQL dialect of the
* SAP Sybase SQL Anywhere 12 database platform.
*
* @deprecated Use SQLAnywhere 16 or newer
*/
class SQLAnywhere12Platform extends SQLAnywhere11Platform
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
/**
* The SQLAnywherePlatform provides the behavior, features and SQL dialect of the
* SAP Sybase SQL Anywhere 10 database platform.
*
* @deprecated Use SQLAnywhere 16 or newer
*/
class SQLAnywherePlatform extends AbstractPlatform
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Platforms/SQLAzurePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* On top of SQL Server 2008 the following functionality is added:
*
* - Create tables with the FEDERATED ON syntax.
*
* @deprecated
*/
class SQLAzurePlatform extends SQLServer2008Platform
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Platforms/SQLServer2005Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* NVARCHAR(max) replace the old TEXT, NTEXT and IMAGE types. See
* {@link http://www.sql-server-helper.com/faq/sql-server-2005-varchar-max-p01.aspx}
* for more information.
*
* @deprecated Use SQL Server 2012 or newer
*/
class SQLServer2005Platform extends SQLServerPlatform
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Platforms/SQLServer2008Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*
* Differences to SQL Server 2005 and before are that a new DATETIME2 type was
* introduced that has a higher precision.
*
* @deprecated Use SQL Server 2012 or newer
*/
class SQLServer2008Platform extends SQLServer2005Platform
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
/**
* The SQLServerPlatform provides the behavior, features and SQL dialect of the
* Microsoft SQL Server database platform.
*
* @deprecated Use SQL Server 2012 or newer
*/
class SQLServerPlatform extends AbstractPlatform
{
Expand Down
44 changes: 44 additions & 0 deletions lib/Doctrine/DBAL/Query/Expression/CompositeExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Doctrine\DBAL\Query\Expression;

use Countable;
use function array_merge;
use function count;
use function implode;

Expand Down Expand Up @@ -36,6 +37,8 @@ class CompositeExpression implements Countable
private $parts = [];

/**
* @internal Use the and() / or() factory methods.
*
* @param string $type Instance type of composite expression.
* @param self[]|string[] $parts Composition of expressions to be joined on composite expression.
*/
Expand All @@ -46,9 +49,29 @@ public function __construct($type, array $parts = [])
$this->addMultiple($parts);
}

/**
* @param self|string $part
* @param self|string ...$parts
*/
public static function and($part, ...$parts) : self
{
return new self(self::TYPE_AND, array_merge([$part], $parts));
}

/**
* @param self|string $part
* @param self|string ...$parts
*/
public static function or($part, ...$parts) : self
{
return new self(self::TYPE_OR, array_merge([$part], $parts));
}

/**
* Adds multiple parts to composite expression.
*
* @deprecated This class will be made immutable. Use with() instead.
*
* @param self[]|string[] $parts
*
* @return CompositeExpression
Expand All @@ -65,6 +88,8 @@ public function addMultiple(array $parts = [])
/**
* Adds an expression to composite expression.
*
* @deprecated This class will be made immutable. Use with() instead.
*
* @param mixed $part
*
* @return CompositeExpression
Expand All @@ -84,6 +109,25 @@ public function add($part)
return $this;
}

/**
* Returns a new CompositeExpression with the given parts added.
*
* @param self|string $part
* @param self|string ...$parts
*/
public function with($part, ...$parts) : self
{
$that = clone $this;

$that->parts[] = $part;

foreach ($parts as $part) {
$that->parts[] = $part;
}

return $that;
}

/**
* Retrieves the amount of expressions on composite expression.
*
Expand Down
Loading