From 460aeeb194794929de8f7a133d9b98cc42330b69 Mon Sep 17 00:00:00 2001 From: beberlei Date: Tue, 3 Nov 2009 16:59:13 +0000 Subject: [PATCH] [2.0] Applied patch from DDC-76, LazyLoad AnnotationDriver in ORM Configuration. --- lib/Doctrine/ORM/Configuration.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Doctrine/ORM/Configuration.php b/lib/Doctrine/ORM/Configuration.php index e6ef4a67c..2e577ae25 100644 --- a/lib/Doctrine/ORM/Configuration.php +++ b/lib/Doctrine/ORM/Configuration.php @@ -53,12 +53,6 @@ class Configuration extends \Doctrine\DBAL\Configuration 'autoGenerateProxyClasses' => true, 'proxyNamespace' => null )); - - //TODO: Move this to client code to avoid unnecessary work when a different metadata - // driver is used. - $reader = new \Doctrine\Common\Annotations\AnnotationReader(new \Doctrine\Common\Cache\ArrayCache); - $reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\'); - $this->_attributes['metadataDriverImpl'] = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader); } /** @@ -130,6 +124,12 @@ class Configuration extends \Doctrine\DBAL\Configuration */ public function getMetadataDriverImpl() { + if($this->_attributes['metadataDriverImpl'] == null) { + $reader = new \Doctrine\Common\Annotations\AnnotationReader(new \Doctrine\Common\Cache\ArrayCache); + $reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\'); + $this->_attributes['metadataDriverImpl'] = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader); + } + return $this->_attributes['metadataDriverImpl']; }