DDC-510 - Moved AnnotationDriver Factory Method onto Configuration instance
This commit is contained in:
parent
45cd2afd27
commit
317e84d8d7
@ -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');
|
||||
|
Loading…
x
Reference in New Issue
Block a user