diff --git a/lib/Doctrine/ORM/Proxy/ProxyFactory.php b/lib/Doctrine/ORM/Proxy/ProxyFactory.php index 0660c423f0d..1e3f0cfbce0 100644 --- a/lib/Doctrine/ORM/Proxy/ProxyFactory.php +++ b/lib/Doctrine/ORM/Proxy/ProxyFactory.php @@ -432,8 +432,8 @@ private function getProxyFileName(string $className, string $baseDirectory): str { $baseDirectory = $baseDirectory ?: $this->proxyDir; - return rtrim($baseDirectory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . InternalProxy::MARKER - . str_replace('\\', '', $className) . '.php'; + return rtrim($baseDirectory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . InternalProxy::MARKER . DIRECTORY_SEPARATOR + . str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php'; } private function getProxyFactory(string $className): Closure diff --git a/tests/Doctrine/Tests/ORM/Functional/ReferenceProxyTest.php b/tests/Doctrine/Tests/ORM/Functional/ReferenceProxyTest.php index c0b147dfc56..12ff915c2f3 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ReferenceProxyTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ReferenceProxyTest.php @@ -235,7 +235,8 @@ public function testCommonPersistenceProxy(): void $restName = str_replace($this->_em->getConfiguration()->getProxyNamespace(), '', get_class($entity)); $restName = substr(get_class($entity), strlen($this->_em->getConfiguration()->getProxyNamespace()) + 1); - $proxyFileName = $this->_em->getConfiguration()->getProxyDir() . DIRECTORY_SEPARATOR . str_replace('\\', '', $restName) . '.php'; + $separator = $this->_em->getConfiguration()->isLazyGhostObjectEnabled() ? DIRECTORY_SEPARATOR : ''; + $proxyFileName = $this->_em->getConfiguration()->getProxyDir() . DIRECTORY_SEPARATOR . str_replace('\\', $separator, $restName) . '.php'; self::assertTrue(file_exists($proxyFileName), 'Proxy file name cannot be found generically.'); $entity->__load();