Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Bump DBAL to 2.12 #35974

Merged
merged 5 commits into from Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -79,7 +79,7 @@
},
"require-dev": {
"aws/aws-sdk-php": "^3.155",
"doctrine/dbal": "^2.6|^3.0",
"doctrine/dbal": "^2.12|^3.0",
"filp/whoops": "^2.8",
"guzzlehttp/guzzle": "^7.2",
"league/flysystem-aws-s3-v3": "^2.0",
Expand Down Expand Up @@ -132,7 +132,7 @@
"ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).",
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.155).",
"brianium/paratest": "Required to run tests in parallel (^6.0).",
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6|^3.0).",
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.12|^3.0).",
"filp/whoops": "Required for friendly error pages in development (^2.8).",
"fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).",
"guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^7.2).",
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Connection.php
Expand Up @@ -920,7 +920,7 @@ public function getDoctrineConnection()
$this->doctrineConnection = new DoctrineConnection(array_filter([
'pdo' => $this->getPdo(),
'dbname' => $this->getDatabaseName(),
'driver' => method_exists($driver, 'getName') ? $driver->getName() : null,
'driver' => $driver->getName(),
'serverVersion' => $this->getConfig('server_version'),
]), $driver);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/DBAL/TimestampType.php
Expand Up @@ -2,7 +2,7 @@

namespace Illuminate\Database\DBAL;

use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;

Expand Down
6 changes: 2 additions & 4 deletions src/Illuminate/Database/MySqlConnection.php
Expand Up @@ -2,8 +2,6 @@

namespace Illuminate\Database;

use Doctrine\DBAL\Driver\PDOMySql\Driver as DoctrineDriver;
use Doctrine\DBAL\Version;
use Illuminate\Database\PDO\MySqlDriver;
use Illuminate\Database\Query\Grammars\MySqlGrammar as QueryGrammar;
use Illuminate\Database\Query\Processors\MySqlProcessor;
Expand Down Expand Up @@ -84,10 +82,10 @@ protected function getDefaultPostProcessor()
/**
* Get the Doctrine DBAL driver.
*
* @return \Doctrine\DBAL\Driver\PDOMySql\Driver|\Illuminate\Database\PDO\MySqlDriver
* @return \Illuminate\Database\PDO\MySqlDriver
*/
protected function getDoctrineDriver()
{
return class_exists(Version::class) ? new DoctrineDriver : new MySqlDriver;
return new MySqlDriver;
}
}
7 changes: 5 additions & 2 deletions src/Illuminate/Database/PDO/Concerns/ConnectsToDatabase.php
Expand Up @@ -10,10 +10,13 @@ trait ConnectsToDatabase
/**
* Create a new database connection.
*
* @param array $params
* @param mixed[] $params
* @param string|null $username
* @param string|null $password
* @param mixed[] $driverOptions
* @return \Illuminate\Database\PDO\Connection
*/
public function connect(array $params)
public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
driesvints marked this conversation as resolved.
Show resolved Hide resolved
{
if (! isset($params['pdo']) || ! $params['pdo'] instanceof PDO) {
throw new \InvalidArgumentException('Laravel requires the "pdo" property to be set and be a PDO instance.');
Expand Down
8 changes: 8 additions & 0 deletions src/Illuminate/Database/PDO/MySqlDriver.php
Expand Up @@ -8,4 +8,12 @@
class MySqlDriver extends AbstractMySQLDriver
{
use ConnectsToDatabase;

/**
* {@inheritdoc}
*/
public function getName()
{
return 'pdo_mysql';
}
}
8 changes: 8 additions & 0 deletions src/Illuminate/Database/PDO/PostgresDriver.php
Expand Up @@ -8,4 +8,12 @@
class PostgresDriver extends AbstractPostgreSQLDriver
{
use ConnectsToDatabase;

/**
* {@inheritdoc}
*/
public function getName()
{
return 'pdo_pgsql';
}
}
8 changes: 8 additions & 0 deletions src/Illuminate/Database/PDO/SQLiteDriver.php
Expand Up @@ -8,4 +8,12 @@
class SQLiteDriver extends AbstractSQLiteDriver
{
use ConnectsToDatabase;

/**
* {@inheritdoc}
*/
public function getName()
{
return 'pdo_sqlite';
}
}
19 changes: 18 additions & 1 deletion src/Illuminate/Database/PDO/SqlServerDriver.php
Expand Up @@ -6,10 +6,27 @@

class SqlServerDriver extends AbstractSQLServerDriver
{
public function connect(array $params)
/**
* Create a new database connection.
*
* @param mixed[] $params
* @param string|null $username
* @param string|null $password
* @param mixed[] $driverOptions
* @return \Illuminate\Database\PDO\Connection
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{
return new SqlServerConnection(
new Connection($params['pdo'])
);
}

/**
* {@inheritdoc}
*/
public function getName()
{
return 'pdo_sqlsrv';
}
}
6 changes: 2 additions & 4 deletions src/Illuminate/Database/PostgresConnection.php
Expand Up @@ -2,8 +2,6 @@

namespace Illuminate\Database;

use Doctrine\DBAL\Driver\PDOPgSql\Driver as DoctrineDriver;
use Doctrine\DBAL\Version;
use Illuminate\Database\PDO\PostgresDriver;
use Illuminate\Database\Query\Grammars\PostgresGrammar as QueryGrammar;
use Illuminate\Database\Query\Processors\PostgresProcessor;
Expand Down Expand Up @@ -99,10 +97,10 @@ protected function getDefaultPostProcessor()
/**
* Get the Doctrine DBAL driver.
*
* @return \Doctrine\DBAL\Driver\PDOPgSql\Driver|\Illuminate\Database\PDO\PostgresDriver
* @return \Illuminate\Database\PDO\PostgresDriver
*/
protected function getDoctrineDriver()
{
return class_exists(Version::class) ? new DoctrineDriver : new PostgresDriver;
return new PostgresDriver;
}
}
6 changes: 2 additions & 4 deletions src/Illuminate/Database/SQLiteConnection.php
Expand Up @@ -2,8 +2,6 @@

namespace Illuminate\Database;

use Doctrine\DBAL\Driver\PDOSqlite\Driver as DoctrineDriver;
use Doctrine\DBAL\Version;
use Illuminate\Database\PDO\SQLiteDriver;
use Illuminate\Database\Query\Grammars\SQLiteGrammar as QueryGrammar;
use Illuminate\Database\Query\Processors\SQLiteProcessor;
Expand Down Expand Up @@ -98,11 +96,11 @@ protected function getDefaultPostProcessor()
/**
* Get the Doctrine DBAL driver.
*
* @return \Doctrine\DBAL\Driver\PDOSqlite\Driver|\Illuminate\Database\PDO\SQLiteDriver
* @return \Illuminate\Database\PDO\SQLiteDriver
*/
protected function getDoctrineDriver()
{
return class_exists(Version::class) ? new DoctrineDriver : new SQLiteDriver;
return new SQLiteDriver;
}

/**
Expand Down
6 changes: 2 additions & 4 deletions src/Illuminate/Database/SqlServerConnection.php
Expand Up @@ -3,8 +3,6 @@
namespace Illuminate\Database;

use Closure;
use Doctrine\DBAL\Driver\PDOSqlsrv\Driver as DoctrineDriver;
use Doctrine\DBAL\Version;
use Illuminate\Database\PDO\SqlServerDriver;
use Illuminate\Database\Query\Grammars\SqlServerGrammar as QueryGrammar;
use Illuminate\Database\Query\Processors\SqlServerProcessor;
Expand Down Expand Up @@ -116,10 +114,10 @@ protected function getDefaultPostProcessor()
/**
* Get the Doctrine DBAL driver.
*
* @return \Doctrine\DBAL\Driver\PDOSqlsrv\Driver|\Illuminate\Database\PDO\SqlServerDriver
* @return \Illuminate\Database\PDO\SqlServerDriver
*/
protected function getDoctrineDriver()
{
return class_exists(Version::class) ? new DoctrineDriver : new SqlServerDriver;
return new SqlServerDriver;
}
}
2 changes: 1 addition & 1 deletion src/Illuminate/Database/composer.json
Expand Up @@ -35,7 +35,7 @@
}
},
"suggest": {
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6|^3.0).",
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.12|^3.0).",
"fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).",
"illuminate/console": "Required to use the database commands (^9.0).",
"illuminate/events": "Required to use the observers with Eloquent (^9.0).",
Expand Down