Merge branch 'master' of github.com:doctrine/doctrine2
This commit is contained in:
commit
438dd9141f
@ -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:
|
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 = new \Doctrine\Common\Annotations\AnnotationReader();
|
||||||
$reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
|
$reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
|
||||||
// new code necessary starting here
|
// new code necessary starting here
|
||||||
|
@ -20,8 +20,11 @@
|
|||||||
namespace Doctrine\ORM;
|
namespace Doctrine\ORM;
|
||||||
|
|
||||||
use Doctrine\Common\Cache\Cache,
|
use Doctrine\Common\Cache\Cache,
|
||||||
|
Doctrine\Common\Cache\ArrayCache,
|
||||||
|
Doctrine\Common\Annotations\AnnotationRegistry,
|
||||||
|
Doctrine\Common\Annotations\AnnotationReader,
|
||||||
Doctrine\ORM\Mapping\Driver\Driver,
|
Doctrine\ORM\Mapping\Driver\Driver,
|
||||||
Doctrine\Common\Cache\ArrayCache;
|
Doctrine\ORM\Mapping\Driver\AnnotationDriver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration container for all configuration options of Doctrine.
|
* Configuration container for all configuration options of Doctrine.
|
||||||
@ -122,10 +125,16 @@ class Configuration extends \Doctrine\DBAL\Configuration
|
|||||||
public function newDefaultAnnotationDriver($paths = array())
|
public function newDefaultAnnotationDriver($paths = array())
|
||||||
{
|
{
|
||||||
if (version_compare(\Doctrine\Common\Version::VERSION, '3.0.0-DEV', '>=')) {
|
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());
|
$reader = new \Doctrine\Common\Annotations\CachedReader($reader, new ArrayCache());
|
||||||
} else if (version_compare(\Doctrine\Common\Version::VERSION, '2.1.0-BETA3-DEV', '>=')) {
|
} else if (version_compare(\Doctrine\Common\Version::VERSION, '2.1.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->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
|
$reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
|
||||||
$reader->setIgnoreNotImportedAnnotations(true);
|
$reader->setIgnoreNotImportedAnnotations(true);
|
||||||
$reader->setEnableParsePhpImports(false);
|
$reader->setEnableParsePhpImports(false);
|
||||||
@ -133,10 +142,10 @@ class Configuration extends \Doctrine\DBAL\Configuration
|
|||||||
new \Doctrine\Common\Annotations\IndexedReader($reader), new ArrayCache()
|
new \Doctrine\Common\Annotations\IndexedReader($reader), new ArrayCache()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
|
$reader = new AnnotationReader();
|
||||||
$reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
|
$reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
|
||||||
}
|
}
|
||||||
return new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, (array)$paths);
|
return new AnnotationDriver($reader, (array)$paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,7 +72,6 @@ class AnnotationDriver implements Driver
|
|||||||
public function __construct($reader, $paths = null)
|
public function __construct($reader, $paths = null)
|
||||||
{
|
{
|
||||||
$this->_reader = $reader;
|
$this->_reader = $reader;
|
||||||
AnnotationRegistry::registerFile(__DIR__ . '/DoctrineAnnotations.php');
|
|
||||||
if ($paths) {
|
if ($paths) {
|
||||||
$this->addPaths((array) $paths);
|
$this->addPaths((array) $paths);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user