Commit 317e84d8 authored by Benjamin Eberlei's avatar Benjamin Eberlei

DDC-510 - Moved AnnotationDriver Factory Method onto Configuration instance

parent 45cd2afd
......@@ -130,6 +130,20 @@ class Configuration extends \Doctrine\DBAL\Configuration
$this->_attributes['metadataDriverImpl'] = $driverImpl;
}
/**
* Add a new default annotation driver with a correctly configured annotation reader.
*
* @param array $paths
* @return Mapping\Driver\AnnotationDriver
*/
public function newDefaultAnnotationDriver($paths = array())
{
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
$reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
return new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, (array)$paths);
}
/**
* Adds a namespace under a certain alias.
*
......
......@@ -235,8 +235,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Doctrine\Tests\Proxies');
$driverImpl = \Doctrine\ORM\Mapping\Driver\AnnotationDriver::create();
$config->setMetadataDriverImpl($driverImpl);
$config->setMetadataDriverImpl($config->newDefaultAnnotationDriver());
$conn = $this->sharedFixture['conn'];
$conn->getConfiguration()->setSQLLogger($this->_sqlLoggerStack);
......
......@@ -30,9 +30,8 @@ abstract class OrmTestCase extends DoctrineTestCase
} else {
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
}
$driverImpl = \Doctrine\ORM\Mapping\Driver\AnnotationDriver::create();
$config->setMetadataDriverImpl($driverImpl);
$config->setMetadataDriverImpl($config->newDefaultAnnotationDriver());
$config->setQueryCacheImpl(self::getSharedQueryCacheImpl());
$config->setProxyDir(__DIR__ . '/Proxies');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment