diff --git a/UPGRADE.md b/UPGRADE.md
index 90af43304bb..32d1d0166ff 100644
--- a/UPGRADE.md
+++ b/UPGRADE.md
@@ -295,6 +295,17 @@ The Doctrine\DBAL\Version class is no longer available: please refrain from chec
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.
+## BC BREAK: Removal of Doctrine Cache
+
+The following methods have been removed.
+
+| class | method | replacement |
+| ------------------- | ------------------------ | ------------------ |
+| `Configuration` | `setResultCacheImpl()` | `setResultCache()` |
+| `Configuration` | `getResultCacheImpl()` | `getResultCache()` |
+| `QueryCacheProfile` | `setResultCacheDriver()` | `setResultCache()` |
+| `QueryCacheProfile` | `getResultCacheDriver()` | `getResultCache()` |
+
# Upgrade to 3.3
## Deprecation of Doctrine Cache
diff --git a/composer.json b/composer.json
index c046ea0ced6..d7fd87e1f96 100644
--- a/composer.json
+++ b/composer.json
@@ -33,7 +33,6 @@
"require": {
"php": "^7.3 || ^8.0",
"composer/package-versions-deprecated": "^1.11.99",
- "doctrine/cache": "^1.11",
"doctrine/deprecations": "^0.5.3",
"doctrine/event-manager": "^1.0",
"psr/cache": "^1|^2|^3"
diff --git a/phpstan.neon.dist b/phpstan.neon.dist
index d1d8840ac70..f82076114c4 100644
--- a/phpstan.neon.dist
+++ b/phpstan.neon.dist
@@ -123,12 +123,6 @@ parameters:
message: '~^Instanceof between Doctrine\\DBAL\\Platforms\\Keywords\\KeywordList and Doctrine\\DBAL\\Platforms\\Keywords\\KeywordList will always evaluate to true\.~'
paths:
- %currentWorkingDirectory%/src/Platforms/AbstractPlatform.php
-
- # We're checking for invalid invalid input
- -
- message: "#^Strict comparison using \\!\\=\\= between null and null will always evaluate to false\\.$#"
- count: 1
- path: src/Cache/QueryCacheProfile.php
includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
diff --git a/psalm.xml.dist b/psalm.xml.dist
index cf9df327d45..2286ac5aa07 100644
--- a/psalm.xml.dist
+++ b/psalm.xml.dist
@@ -45,11 +45,6 @@
is no longer supported.
-->
-
-
@@ -66,15 +61,6 @@
-
-
-
-
-
-
-
diff --git a/src/Cache/QueryCacheProfile.php b/src/Cache/QueryCacheProfile.php
index 8d04a44603e..e4317aee6ce 100644
--- a/src/Cache/QueryCacheProfile.php
+++ b/src/Cache/QueryCacheProfile.php
@@ -4,20 +4,13 @@
namespace Doctrine\DBAL\Cache;
-use Doctrine\Common\Cache\Cache;
-use Doctrine\Common\Cache\Psr6\CacheAdapter;
-use Doctrine\Common\Cache\Psr6\DoctrineProvider;
use Doctrine\DBAL\Cache\Exception\NoCacheKey;
use Doctrine\DBAL\Types\Type;
-use Doctrine\Deprecations\Deprecation;
use Psr\Cache\CacheItemPoolInterface;
-use TypeError;
-use function get_class;
use function hash;
use function serialize;
use function sha1;
-use function sprintf;
/**
* Query Cache Profile handles the data relevant for query caching.
@@ -35,31 +28,11 @@ class QueryCacheProfile
/** @var string|null */
private $cacheKey;
- public function __construct(int $lifetime = 0, ?string $cacheKey = null, ?object $resultCache = null)
+ public function __construct(int $lifetime = 0, ?string $cacheKey = null, ?CacheItemPoolInterface $resultCache = null)
{
- $this->lifetime = $lifetime;
- $this->cacheKey = $cacheKey;
- if ($resultCache instanceof CacheItemPoolInterface) {
- $this->resultCache = $resultCache;
- } elseif ($resultCache instanceof Cache) {
- Deprecation::trigger(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/4620',
- 'Passing an instance of %s to %s as $resultCache is deprecated. Pass an instance of %s instead.',
- Cache::class,
- __METHOD__,
- CacheItemPoolInterface::class
- );
-
- $this->resultCache = CacheAdapter::wrap($resultCache);
- } elseif ($resultCache !== null) {
- throw new TypeError(sprintf(
- '$resultCache: Expected either null or an instance of %s or %s, got %s.',
- CacheItemPoolInterface::class,
- Cache::class,
- get_class($resultCache)
- ));
- }
+ $this->lifetime = $lifetime;
+ $this->cacheKey = $cacheKey;
+ $this->resultCache = $resultCache;
}
public function getResultCache(): ?CacheItemPoolInterface
@@ -67,21 +40,6 @@ public function getResultCache(): ?CacheItemPoolInterface
return $this->resultCache;
}
- /**
- * @deprecated Use {@see getResultCache()} instead.
- */
- public function getResultCacheDriver(): ?Cache
- {
- Deprecation::trigger(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/4620',
- '%s is deprecated, call getResultCache() instead.',
- __METHOD__
- );
-
- return $this->resultCache !== null ? DoctrineProvider::wrap($this->resultCache) : null;
- }
-
public function getLifetime(): int
{
return $this->lifetime;
@@ -130,23 +88,6 @@ public function setResultCache(CacheItemPoolInterface $cache): QueryCacheProfile
return new QueryCacheProfile($this->lifetime, $this->cacheKey, $cache);
}
- /**
- * @deprecated Use {@see setResultCache()} instead.
- *
- * @return QueryCacheProfile
- */
- public function setResultCacheDriver(Cache $cache): self
- {
- Deprecation::trigger(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/4620',
- '%s is deprecated, call setResultCache() instead.',
- __METHOD__
- );
-
- return new QueryCacheProfile($this->lifetime, $this->cacheKey, CacheAdapter::wrap($cache));
- }
-
public function setCacheKey(?string $cacheKey): self
{
return new QueryCacheProfile($this->lifetime, $cacheKey, $this->resultCache);
diff --git a/src/Configuration.php b/src/Configuration.php
index 328e2fcdd34..a83d55a2b0f 100644
--- a/src/Configuration.php
+++ b/src/Configuration.php
@@ -4,13 +4,9 @@
namespace Doctrine\DBAL;
-use Doctrine\Common\Cache\Cache;
-use Doctrine\Common\Cache\Psr6\CacheAdapter;
-use Doctrine\Common\Cache\Psr6\DoctrineProvider;
use Doctrine\DBAL\Driver\Middleware;
use Doctrine\DBAL\Logging\NullLogger;
use Doctrine\DBAL\Logging\SQLLogger;
-use Doctrine\Deprecations\Deprecation;
use Psr\Cache\CacheItemPoolInterface;
/**
@@ -35,15 +31,6 @@ class Configuration
*/
private $resultCache;
- /**
- * The cache driver implementation that is used for query result caching.
- *
- * @deprecated Use {@see $resultCache} instead.
- *
- * @var Cache|null
- */
- protected $resultCacheImpl;
-
/**
* The callable to use to filter schema assets.
*
@@ -82,48 +69,12 @@ public function getResultCache(): ?CacheItemPoolInterface
return $this->resultCache;
}
- /**
- * Gets the cache driver implementation that is used for query result caching.
- *
- * @deprecated Use {@see getResultCache()} instead.
- */
- public function getResultCacheImpl(): ?Cache
- {
- Deprecation::trigger(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/4620',
- '%s is deprecated, call getResultCache() instead.',
- __METHOD__
- );
-
- return $this->resultCacheImpl;
- }
-
/**
* Sets the cache driver implementation that is used for query result caching.
*/
public function setResultCache(CacheItemPoolInterface $cache): void
{
- $this->resultCacheImpl = DoctrineProvider::wrap($cache);
- $this->resultCache = $cache;
- }
-
- /**
- * Sets the cache driver implementation that is used for query result caching.
- *
- * @deprecated Use {@see setResultCache()} instead.
- */
- public function setResultCacheImpl(Cache $cacheImpl): void
- {
- Deprecation::trigger(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/4620',
- '%s is deprecated, call setResultCache() instead.',
- __METHOD__
- );
-
- $this->resultCacheImpl = $cacheImpl;
- $this->resultCache = CacheAdapter::wrap($cacheImpl);
+ $this->resultCache = $cache;
}
/**
diff --git a/tests/Functional/ResultCacheTest.php b/tests/Functional/ResultCacheTest.php
index b3014c9bf69..00acf1a0219 100644
--- a/tests/Functional/ResultCacheTest.php
+++ b/tests/Functional/ResultCacheTest.php
@@ -4,7 +4,6 @@
namespace Doctrine\DBAL\Tests\Functional;
-use Doctrine\Common\Cache\ArrayCache;
use Doctrine\DBAL\Cache\QueryCacheProfile;
use Doctrine\DBAL\Logging\DebugStack;
use Doctrine\DBAL\Result;
@@ -226,25 +225,6 @@ public function testFetchingAllRowsSavesCache(callable $fetchAll): void
self::assertCount(1, $layerCache->getItem('testcachekey')->get());
}
- /**
- * @dataProvider fetchAllProvider
- */
- public function testFetchingAllRowsSavesCacheLegacy(callable $fetchAll): void
- {
- $layerCache = new ArrayCache();
-
- $result = $this->connection->executeQuery(
- 'SELECT * FROM caching WHERE test_int > 500',
- [],
- [],
- new QueryCacheProfile(0, 'testcachekey', $layerCache)
- );
-
- $fetchAll($result);
-
- self::assertCount(1, $layerCache->fetch('testcachekey'));
- }
-
/**
* @return iterable>
*/
@@ -370,36 +350,6 @@ public function testChangeCacheImpl(): void
self::assertCount(1, $secondCache->getItem('emptycachekey')->get());
}
- public function testChangeCacheImplLegacy(): void
- {
- $stmt = $this->connection->executeQuery(
- 'SELECT * FROM caching WHERE test_int > 500',
- [],
- [],
- new QueryCacheProfile(10, 'emptycachekey')
- );
-
- $this->hydrateViaIteration($stmt, static function (Result $result) {
- return $result->fetchAssociative();
- });
-
- $secondCache = new ArrayCache();
-
- $stmt = $this->connection->executeQuery(
- 'SELECT * FROM caching WHERE test_int > 500',
- [],
- [],
- new QueryCacheProfile(10, 'emptycachekey', $secondCache)
- );
-
- $this->hydrateViaIteration($stmt, static function (Result $result) {
- return $result->fetchAssociative();
- });
-
- self::assertCount(2, $this->sqlLogger->queries, 'two hits');
- self::assertCount(1, $secondCache->fetch('emptycachekey'));
- }
-
/**
* @return iterable>
*/