Skip to content

Commit 7374131

Browse files
authored
Deprecate Configuration::getProxyDir and setProxyDir (#2911)
1 parent 59f2126 commit 7374131

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

UPGRADE-2.16.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# UPGRADE FROM 2.15 to 2.16
2+
3+
## Lazy Proxy Directory
4+
5+
Using proxy classes with PHP 8.4+ is deprecated, only native lazy objects will
6+
be supported in MongoDB ODM 3.0.
7+
8+
Calling `Doctrine\ODM\MongoDB\Configuration::setProxyDir()` or
9+
`Doctrine\ODM\MongoDB\Configuration::getProxyDir()` is deprecated and triggers
10+
a deprecation notice when using native lazy objects.

src/Configuration.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ public function setMetadataCache(CacheItemPoolInterface $cache): void
316316

317317
/**
318318
* Sets the directory where Doctrine generates any necessary proxy class files.
319+
*
320+
* @deprecated Since 2.16, proxy directory is no longer used when native lazy objects are enabled.
319321
*/
320322
public function setProxyDir(string $dir): void
321323
{
@@ -325,9 +327,15 @@ public function setProxyDir(string $dir): void
325327

326328
/**
327329
* Gets the directory where Doctrine generates any necessary proxy class files.
330+
*
331+
* @deprecated Since 2.16, proxy directory is no longer used when native lazy objects are enabled.
328332
*/
329333
public function getProxyDir(): ?string
330334
{
335+
if ($this->isNativeLazyObjectEnabled()) {
336+
trigger_deprecation('doctrine/mongodb-odm', '2.16', 'Using "%s" is deprecated when native lazy objects are enabled.', __METHOD__);
337+
}
338+
331339
return $this->attributes['proxyDir'] ?? null;
332340
}
333341

0 commit comments

Comments
 (0)