diff --git a/lib/Doctrine/ProxyClassNameResolver.php b/lib/Doctrine/ProxyClassNameResolver.php new file mode 100644 index 0000000000..94ead19cdf --- /dev/null +++ b/lib/Doctrine/ProxyClassNameResolver.php @@ -0,0 +1,27 @@ + + */ + public function resolveClassName(string $className) : string { + $pos = \strrpos($className, '\\' . \MailPoetVendor\Doctrine\Persistence\Proxy::MARKER . '\\'); + if ($pos === \false) { + /** @var class-string */ + return $className; + } + /** @var class-string */ + return \substr($className, $pos + \MailPoetVendor\Doctrine\Persistence\Proxy::MARKER_LENGTH + 2); + } +} diff --git a/lib/Doctrine/TablePrefixMetadataFactory.php b/lib/Doctrine/TablePrefixMetadataFactory.php index f36bdf3f92..15540ab123 100644 --- a/lib/Doctrine/TablePrefixMetadataFactory.php +++ b/lib/Doctrine/TablePrefixMetadataFactory.php @@ -22,6 +22,7 @@ class TablePrefixMetadataFactory extends ClassMetadataFactory { throw new \RuntimeException('DB table prefix not initialized'); } $this->prefix = Env::$dbPrefix; + $this->setProxyClassNameResolver(new ProxyClassNameResolver()); } public function getMetadataFor($className) {