1
0
mirror of synced 2025-01-18 22:41:43 +03:00

DDC-510 - Moved AnnotationDriver Factory Method onto Configuration instance

This commit is contained in:
Benjamin Eberlei 2010-04-11 11:06:54 +02:00
parent 45cd2afd27
commit 317e84d8d7
3 changed files with 17 additions and 5 deletions

View File

@ -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.
*

View File

@ -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);

View File

@ -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');