Skip to content

Commit

Permalink
Error out if incompatible DBAL version is detected
Browse files Browse the repository at this point in the history
doctrine/dbal is an optional dependency of laravel/framework, and v3 of
the DBAL has been released recently, but obviously, Laravel 6 was never
meant to be compatible with that version.
Users still using Laravel 6 and updating their dependencies get confused
and file invalid reports on the DBAL, see for instance
doctrine/dbal#4439
or
doctrine/dbal#4757

Fixes #24271
  • Loading branch information
greg0ire committed Aug 25, 2021
1 parent e18f414 commit 196f14f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Illuminate/Database/SQLiteConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Database\Query\Processors\SQLiteProcessor;
use Illuminate\Database\Schema\Grammars\SQLiteGrammar as SchemaGrammar;
use Illuminate\Database\Schema\SQLiteBuilder;
use LogicException;

class SQLiteConnection extends Connection
{
Expand Down Expand Up @@ -85,6 +86,12 @@ protected function getDefaultPostProcessor()
*/
protected function getDoctrineDriver()
{
if (! class_exists(DoctrineDriver::class)) {
throw new LogicException(
'Laravel v6 is only compatible with doctrine/dbal 2, lock it to that version with composer require doctrine/dbal "^2.0"'
);
}

return new DoctrineDriver;
}

Expand Down

0 comments on commit 196f14f

Please sign in to comment.