1
0
mirror of synced 2024-12-13 22:56:04 +03:00

Merge branch 'master' of github.com:doctrine/doctrine2

This commit is contained in:
Guilherme Blanco 2011-07-04 11:38:45 -03:00
commit 438dd9141f
3 changed files with 17 additions and 7 deletions

View File

@ -9,6 +9,8 @@ The EntityRepository now has an interface Doctrine\Common\Persistence\ObjectRepo
The annotation reader was heavily refactored between 2.0 and 2.1-RC1. In theory the operation of the new reader should be backwards compatible, but it has to be setup differently to work that way:
\Doctrine\Common\Annotations\AnnotationRegistry::registerFile('/doctrine-src/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
$reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
// new code necessary starting here

View File

@ -20,8 +20,11 @@
namespace Doctrine\ORM;
use Doctrine\Common\Cache\Cache,
Doctrine\Common\Cache\ArrayCache,
Doctrine\Common\Annotations\AnnotationRegistry,
Doctrine\Common\Annotations\AnnotationReader,
Doctrine\ORM\Mapping\Driver\Driver,
Doctrine\Common\Cache\ArrayCache;
Doctrine\ORM\Mapping\Driver\AnnotationDriver;
/**
* Configuration container for all configuration options of Doctrine.
@ -122,10 +125,16 @@ class Configuration extends \Doctrine\DBAL\Configuration
public function newDefaultAnnotationDriver($paths = array())
{
if (version_compare(\Doctrine\Common\Version::VERSION, '3.0.0-DEV', '>=')) {
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
// Register the ORM Annotations in the AnnotationRegistry
AnnotationRegistry::registerFile(__DIR__ . '/Mapping/Driver/DoctrineAnnotations.php');
$reader = new AnnotationReader();
$reader = new \Doctrine\Common\Annotations\CachedReader($reader, new ArrayCache());
} else if (version_compare(\Doctrine\Common\Version::VERSION, '2.1.0-BETA3-DEV', '>=')) {
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
} else if (version_compare(\Doctrine\Common\Version::VERSION, '2.1.0-DEV', '>=')) {
// Register the ORM Annotations in the AnnotationRegistry
AnnotationRegistry::registerFile(__DIR__ . '/Mapping/Driver/DoctrineAnnotations.php');
$reader = new AnnotationReader();
$reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
$reader->setIgnoreNotImportedAnnotations(true);
$reader->setEnableParsePhpImports(false);
@ -133,10 +142,10 @@ class Configuration extends \Doctrine\DBAL\Configuration
new \Doctrine\Common\Annotations\IndexedReader($reader), new ArrayCache()
);
} else {
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
$reader = new AnnotationReader();
$reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
}
return new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, (array)$paths);
return new AnnotationDriver($reader, (array)$paths);
}
/**

View File

@ -72,7 +72,6 @@ class AnnotationDriver implements Driver
public function __construct($reader, $paths = null)
{
$this->_reader = $reader;
AnnotationRegistry::registerFile(__DIR__ . '/DoctrineAnnotations.php');
if ($paths) {
$this->addPaths((array) $paths);
}