diff --git a/src/Kdyby/Doctrine/DI/OrmExtension.php b/src/Kdyby/Doctrine/DI/OrmExtension.php index 23ca9613..7541cf0f 100644 --- a/src/Kdyby/Doctrine/DI/OrmExtension.php +++ b/src/Kdyby/Doctrine/DI/OrmExtension.php @@ -294,8 +294,8 @@ protected function processEntityManager($name, array $defaults) if (empty($config['metadata'])) { $metadataDriver->addSetup('setDefaultDriver', [ new Statement($this->metadataDriverClasses[self::ANNOTATION_DRIVER], [ - [$builder->expand('%appDir%')], - 2 => $this->prefix('@cache.' . $name . '.metadata') + '@' . Doctrine\Common\Annotations\Reader::class, + [$builder->expand('%appDir%')] ]) ]); } diff --git a/tests/KdybyTests/Doctrine/Extension.phpt b/tests/KdybyTests/Doctrine/Extension.phpt index 28b86d6e..7a119b5a 100644 --- a/tests/KdybyTests/Doctrine/Extension.phpt +++ b/tests/KdybyTests/Doctrine/Extension.phpt @@ -155,6 +155,21 @@ class ExtensionTest extends Tester\TestCase + public function testMetadataEmpty() + { + $container = $this->createContainer('metadata-empty'); + + /** @var Kdyby\Doctrine\EntityManager $default */ + $default = $container->getByType(\Kdyby\Doctrine\EntityManager::class); + $entityClasses = array_map(function (ClassMetadata $class) { + return $class->getName(); + }, $default->getMetadataFactory()->getAllMetadata()); + + Assert::contains(\KdybyTests\Doctrine\Models2\Foo::class, $entityClasses); + } + + + public function testProxyAutoloading() { $env = $_ENV + ['TEMP_DIR' => $scriptTempDir = TEMP_DIR . '/script']; diff --git a/tests/KdybyTests/Doctrine/config/metadata-empty.neon b/tests/KdybyTests/Doctrine/config/metadata-empty.neon new file mode 100644 index 00000000..54c4d439 --- /dev/null +++ b/tests/KdybyTests/Doctrine/config/metadata-empty.neon @@ -0,0 +1,6 @@ +parameters: + appDir: %wwwDir%/Doctrine/models2 + +kdyby.doctrine: + driver: pdo_sqlite + memory: true