diff --git a/src/Eccube/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php b/src/Eccube/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php index dcb150e16a1..5a67181048f 100644 --- a/src/Eccube/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php +++ b/src/Eccube/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php @@ -76,9 +76,17 @@ public function getAllClassNames() $sourceFile = str_replace('\\', '/', $sourceFile); $projectDir = str_replace('\\', '/', $projectDir); } - // Replace /path/to/ec-cube to proxies path - $proxyFile = str_replace($projectDir, $this->trait_proxies_directory, $path).'/'.basename($sourceFile); - if (file_exists($proxyFile)) { + + $entityPath = $projectDir . '/src/Eccube/Entity/'; + $proxyFile = null; + if (strpos($sourceFile, $entityPath) === 0) { + // Entity class + $entityClass = substr($sourceFile, strlen($entityPath)); + // Replace /path/to/ec-cube to proxies path + $proxyFile = str_replace($projectDir, $this->trait_proxies_directory, $path).'/'.$entityClass; + } + + if ($proxyFile !== null && file_exists($proxyFile)) { require_once $proxyFile; $sourceFile = $proxyFile;