diff --git a/UPGRADE-2.16.md b/UPGRADE-2.16.md new file mode 100644 index 000000000..66ff97d75 --- /dev/null +++ b/UPGRADE-2.16.md @@ -0,0 +1,10 @@ +# UPGRADE FROM 2.15 to 2.16 + +## Lazy Proxy Directory + +Using proxy classes with PHP 8.4+ is deprecated, only native lazy objects will +be supported in MongoDB ODM 3.0. + +Calling `Doctrine\ODM\MongoDB\Configuration::setProxyDir()` or +`Doctrine\ODM\MongoDB\Configuration::getProxyDir()` is deprecated and triggers +a deprecation notice when using native lazy objects. diff --git a/src/Configuration.php b/src/Configuration.php index 8e1faf488..6a3e8724c 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -316,6 +316,8 @@ public function setMetadataCache(CacheItemPoolInterface $cache): void /** * Sets the directory where Doctrine generates any necessary proxy class files. + * + * @deprecated Since 2.16, proxy directory is no longer used when native lazy objects are enabled. */ public function setProxyDir(string $dir): void { @@ -325,9 +327,15 @@ public function setProxyDir(string $dir): void /** * Gets the directory where Doctrine generates any necessary proxy class files. + * + * @deprecated Since 2.16, proxy directory is no longer used when native lazy objects are enabled. */ public function getProxyDir(): ?string { + if ($this->isNativeLazyObjectEnabled()) { + trigger_deprecation('doctrine/mongodb-odm', '2.16', 'Using "%s" is deprecated when native lazy objects are enabled.', __METHOD__); + } + return $this->attributes['proxyDir'] ?? null; }