Skip to content

Commit 819f35b

Browse files
committed
Drop support of doctrine/dbal 2
1 parent 22b99bf commit 819f35b

File tree

10 files changed

+83
-400
lines changed

10 files changed

+83
-400
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ env:
1111

1212
jobs:
1313
phpunit:
14-
name: "PHPUnit ${{ matrix.php-version }} (${{ matrix.deps }})${{ matrix.dbal-version && format(' - DBAL {0}', matrix.dbal-version) || '' }}"
14+
name: "PHPUnit ${{ matrix.php-version }} (${{ matrix.deps }})"
1515
runs-on: "ubuntu-20.04"
1616

1717
services:
@@ -29,17 +29,9 @@ jobs:
2929
- "8.2"
3030
deps:
3131
- "highest"
32-
dbal-version:
33-
- ""
3432
include:
3533
- deps: "lowest"
3634
php-version: "7.4"
37-
- deps: "highest"
38-
php-version: "8.2"
39-
dbal-version: "^2.13.1"
40-
- deps: "highest"
41-
php-version: "8.2"
42-
dbal-version: "^3.2"
4335
- deps: "highest"
4436
php-version: "8.1"
4537

@@ -56,10 +48,6 @@ jobs:
5648
extensions: mongodb
5749
coverage: "pcov"
5850

59-
- name: "Restrict DBAL version"
60-
if: "${{ matrix.dbal-version }}"
61-
run: "composer require --dev --no-update doctrine/dbal:${{ matrix.dbal-version }}"
62-
6351
# Remove PHP-CS-Fixer to avoid conflicting dependency ranges (i.e. doctrine/annotations)
6452
- name: "Remove PHP-CS-Fixer"
6553
run: "composer remove --dev --no-update friendsofphp/php-cs-fixer"

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ a release.
2121
### Changed
2222
- Dropped support for PHP < 7.4
2323
- Dropped support for Symfony < 5.4
24+
- Dropped support for doctrine/dbal < 3.2
2425

2526
### Deprecated
2627
- Calling `Gedmo\Mapping\Event\Adapter\ORM::getObjectManager()` and `getObject()` on EventArgs that do not implement `getObjectManager()` and `getObject()` (such as old EventArgs implementing `getEntityManager()` and `getEntity()`)

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
},
5454
"require-dev": {
5555
"doctrine/cache": "^1.11 || ^2.0",
56-
"doctrine/dbal": "^2.13.1 || ^3.2",
56+
"doctrine/dbal": "^3.2",
5757
"doctrine/doctrine-bundle": "^2.3",
5858
"doctrine/mongodb-odm": "^2.3",
5959
"doctrine/orm": "^2.14.0",
@@ -69,7 +69,7 @@
6969
"symfony/yaml": "^5.4 || ^6.0"
7070
},
7171
"conflict": {
72-
"doctrine/dbal": "<2.13.1 || ^3.0 <3.2",
72+
"doctrine/dbal": "<3.2",
7373
"doctrine/mongodb-odm": "<2.3",
7474
"doctrine/orm": "<2.14.0 || 2.16.0 || 2.16.1",
7575
"sebastian/comparator": "<2.0"

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,3 @@ parameters:
635635
count: 1
636636
path: tests/Gedmo/Tree/RepositoryTest.php
637637

638-
-
639-
message: "#^Variable \\$stack might not be defined\\.$#"
640-
count: 3
641-
path: tests/Gedmo/Tree/TreeObjectHydratorTest.php
642-

tests/Gedmo/Sortable/Fixture/CustomerType.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Doctrine\Common\Collections\ArrayCollection;
1515
use Doctrine\Common\Collections\Collection;
1616
use Doctrine\DBAL\Driver\PDO\Exception as PDODriverException;
17-
use Doctrine\DBAL\Driver\PDOException as LegacyPDOException;
1817
use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException;
1918
use Doctrine\DBAL\Types\Types;
2019
use Doctrine\ORM\Mapping as ORM;
@@ -124,12 +123,6 @@ public function postRemove(): void
124123

125124
$pdoException = new \PDOException('SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails', 23000);
126125

127-
// @todo: This check can be removed when dropping support for doctrine/dbal 2.x.
128-
if (class_exists(LegacyPDOException::class)) {
129-
// @phpstan-ignore-next-line
130-
throw new ForeignKeyConstraintViolationException(sprintf('An exception occurred while deleting the customer type with id %s.', $this->getId()), new LegacyPDOException($pdoException));
131-
}
132-
133126
throw new ForeignKeyConstraintViolationException(PDODriverException::new($pdoException), null);
134127
}
135128
}

tests/Gedmo/Tool/BaseTestCaseORM.php

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Gedmo\Tests\Tool;
1313

1414
use Doctrine\Common\EventManager;
15-
use Doctrine\DBAL\Driver;
1615
use Doctrine\DBAL\DriverManager;
1716
use Doctrine\DBAL\Logging\Middleware;
1817
use Doctrine\ORM\Configuration;
@@ -41,8 +40,6 @@ abstract class BaseTestCaseORM extends TestCase
4140
{
4241
protected ?EntityManager $em = null;
4342

44-
protected QueryAnalyzer $queryAnalyzer;
45-
4643
protected QueryLogger $queryLogger;
4744

4845
protected function setUp(): void
@@ -75,22 +72,6 @@ protected function getDefaultMockSqliteEntityManager(?EventManager $evm = null,
7572
return $this->em = $em;
7673
}
7774

78-
/**
79-
* TODO: Remove this method when dropping support of doctrine/dbal 2.
80-
*
81-
* Starts query statistic log
82-
*
83-
* @throws \RuntimeException
84-
*/
85-
protected function startQueryLog(): void
86-
{
87-
if (null === $this->em) {
88-
throw new \RuntimeException('EntityManager must be initialized.');
89-
}
90-
$this->queryAnalyzer = new QueryAnalyzer($this->em->getConnection()->getDatabasePlatform());
91-
$this->em->getConfiguration()->setSQLLogger($this->queryAnalyzer);
92-
}
93-
9475
/**
9576
* Creates default mapping driver
9677
*/
@@ -118,13 +99,9 @@ protected function getDefaultConfiguration(): Configuration
11899
$config->setProxyDir(TESTS_TEMP_DIR);
119100
$config->setProxyNamespace('Proxy');
120101
$config->setMetadataDriverImpl($this->getMetadataDriverImplementation());
121-
122-
// TODO: Remove the "if" check when dropping support of doctrine/dbal 2.
123-
if (class_exists(Middleware::class)) {
124-
$config->setMiddlewares([
125-
new Middleware($this->queryLogger),
126-
]);
127-
}
102+
$config->setMiddlewares([
103+
new Middleware($this->queryLogger),
104+
]);
128105

129106
return $config;
130107
}

tests/Gedmo/Tool/QueryAnalyzer.php

Lines changed: 0 additions & 133 deletions
This file was deleted.

0 commit comments

Comments
 (0)