Skip to content

Commit

Permalink
Merge pull request #317 from janatjak/v3.3
Browse files Browse the repository at this point in the history
Fix empty metadata (annotation driver)
  • Loading branch information
enumag authored Jan 18, 2018
2 parents d14c0b0 + f370e4f commit 5db2470
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Kdyby/Doctrine/DI/OrmExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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%')]
])
]);
}
Expand Down
15 changes: 15 additions & 0 deletions tests/KdybyTests/Doctrine/Extension.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
6 changes: 6 additions & 0 deletions tests/KdybyTests/Doctrine/config/metadata-empty.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
appDir: %wwwDir%/Doctrine/models2

kdyby.doctrine:
driver: pdo_sqlite
memory: true

0 comments on commit 5db2470

Please sign in to comment.