Johannes Schmitt 14 年 前
コミット
42fb34b647

+ 3 - 3
src/Symfony/Bundle/DoctrineBundle/Annotations/Reader.php

@@ -2,7 +2,7 @@
 
 namespace Symfony\Bundle\DoctrineBundle\Annotations;
 
-use Doctrine\Common\Annotations\ReaderInterface;
+use Doctrine\Common\Annotations\Reader;
 
 /**
  * Allows the reader to be used in-place of Doctrine's reader.
@@ -11,11 +11,11 @@ use Doctrine\Common\Annotations\ReaderInterface;
  *
  * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  */
-class Reader implements ReaderInterface
+class IndexedReader implements Reader
 {
     private $delegate;
 
-    public function __construct(ReaderInterface $reader)
+    public function __construct(Reader $reader)
     {
         $this->delegate = $reader;
     }

+ 1 - 1
src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml

@@ -20,7 +20,7 @@
         <!-- metadata -->
         <parameter key="doctrine.orm.metadata.driver_chain.class">Doctrine\ORM\Mapping\Driver\DriverChain</parameter>
         <parameter key="doctrine.orm.metadata.annotation.class">Doctrine\ORM\Mapping\Driver\AnnotationDriver</parameter>
-        <parameter key="doctrine.orm.metadata.annotation_reader.class">Symfony\Bundle\DoctrineBundle\Annotations\Reader</parameter>
+        <parameter key="doctrine.orm.metadata.annotation_reader.class">Symfony\Bundle\DoctrineBundle\Annotations\IndexedReader</parameter>
         <parameter key="doctrine.orm.metadata.xml.class">Symfony\Bundle\DoctrineBundle\Mapping\Driver\XmlDriver</parameter>
         <parameter key="doctrine.orm.metadata.yml.class">Symfony\Bundle\DoctrineBundle\Mapping\Driver\YamlDriver</parameter>
         <parameter key="doctrine.orm.metadata.php.class">Doctrine\ORM\Mapping\Driver\PHPDriver</parameter>

+ 1 - 1
src/Symfony/Bundle/DoctrineBundle/Tests/ContainerTest.php

@@ -24,7 +24,7 @@ class ContainerTest extends TestCase
         $this->assertInstanceOf('Doctrine\DBAL\Configuration', $container->get('doctrine.dbal.default_connection.configuration'));
         $this->assertInstanceOf('Doctrine\Common\EventManager', $container->get('doctrine.dbal.default_connection.event_manager'));
         $this->assertInstanceOf('Doctrine\DBAL\Connection', $container->get('doctrine.dbal.default_connection'));
-        $this->assertInstanceOf('Doctrine\Common\Annotations\ReaderInterface', $container->get('doctrine.orm.metadata.annotation_reader'));
+        $this->assertInstanceOf('Doctrine\Common\Annotations\Reader', $container->get('doctrine.orm.metadata.annotation_reader'));
         $this->assertInstanceOf('Doctrine\ORM\Configuration', $container->get('doctrine.orm.default_configuration'));
         $this->assertInstanceOf('Doctrine\ORM\Mapping\Driver\DriverChain', $container->get('doctrine.orm.default_metadata_driver'));
         $this->assertInstanceOf('Doctrine\Common\Cache\ArrayCache', $container->get('doctrine.orm.default_metadata_cache'));

+ 4 - 3
src/Symfony/Bundle/DoctrineBundle/Tests/TestCase.php

@@ -11,7 +11,8 @@
 
 namespace Symfony\Bundle\DoctrineBundle\Tests;
 
-use Doctrine\Common\Annotations\Reader;
+use Doctrine\Common\Annotations\AnnotationReader;
+use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
 use Doctrine\ORM\EntityManager;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
@@ -37,7 +38,7 @@ class TestCase extends \PHPUnit_Framework_TestCase
         $config->setAutoGenerateProxyClasses(true);
         $config->setProxyDir(\sys_get_temp_dir());
         $config->setProxyNamespace('SymfonyTests\Doctrine');
-        $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver($paths));
+        $config->setMetadataDriverImpl(new AnnotationDriver(new AnnotationReader()));
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
 
@@ -57,7 +58,7 @@ class TestCase extends \PHPUnit_Framework_TestCase
             'kernel.cache_dir'   => sys_get_temp_dir(),
             'kernel.root_dir'    => __DIR__ . "/../../../../" // src dir
         )));
-        $container->set('annotation_reader', new Reader());
+        $container->set('annotation_reader', new AnnotationReader());
         $loader = new DoctrineExtension();
         $container->registerExtension($loader);
         $loader->load(array(array(

+ 1 - 1
src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml

@@ -7,7 +7,7 @@
     <parameters>
         <parameter key="annotations.cache.file_cache.class">Doctrine\Common\Annotations\Cache\FileCache</parameter>
 
-        <parameter key="annotations.reader.class">Doctrine\Common\Annotations\Reader</parameter>
+        <parameter key="annotations.reader.class">Doctrine\Common\Annotations\AnnotationReader</parameter>
         <parameter key="annotations.cached_reader.class">Doctrine\Common\Annotations\CachedReader</parameter>
     </parameters>
 

+ 3 - 3
src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php

@@ -11,7 +11,7 @@
 
 namespace Symfony\Component\Routing\Loader;
 
-use Doctrine\Common\Annotations\ReaderInterface;
+use Doctrine\Common\Annotations\Reader;
 use Symfony\Component\Routing\Annotation\Route as RouteAnnotation;
 use Symfony\Component\Config\Resource\FileResource;
 use Symfony\Component\Routing\Route;
@@ -63,9 +63,9 @@ abstract class AnnotationClassLoader implements LoaderInterface
     /**
      * Constructor.
      *
-     * @param ReaderInterface $reader
+     * @param Reader $reader
      */
-    public function __construct(ReaderInterface $reader)
+    public function __construct(Reader $reader)
     {
         $this->reader = $reader;
     }

+ 2 - 2
src/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php

@@ -11,7 +11,7 @@
 
 namespace Symfony\Component\Validator\Mapping\Loader;
 
-use Doctrine\Common\Annotations\ReaderInterface;
+use Doctrine\Common\Annotations\Reader;
 use Symfony\Component\Validator\Exception\MappingException;
 use Symfony\Component\Validator\Mapping\ClassMetadata;
 use Symfony\Component\Validator\Constraints\GroupSequence;
@@ -21,7 +21,7 @@ class AnnotationLoader implements LoaderInterface
 {
     protected $reader;
 
-    public function __construct(ReaderInterface $reader)
+    public function __construct(Reader $reader)
     {
         $this->reader = $reader;
     }

+ 2 - 2
src/Symfony/Component/Validator/ValidatorFactory.php

@@ -11,7 +11,7 @@ namespace Symfony\Component\Validator;
  * file that was distributed with this source code.
  */
 
-use Doctrine\Common\Annotations\Reader;
+use Doctrine\Common\Annotations\AnnotationReader;
 use Symfony\Component\Validator\Exception\MappingException;
 use Symfony\Component\Validator\Mapping\ClassMetadataFactory;
 use Symfony\Component\Validator\Mapping\ClassMetadataFactoryInterface;
@@ -125,7 +125,7 @@ class ValidatorFactory implements ValidatorContextInterface
         }
 
         if ($annotations) {
-            $loaders[] = new AnnotationLoader(new Reader());
+            $loaders[] = new AnnotationLoader(new AnnotationReader());
         }
 
         if ($staticMethod) {

+ 5 - 1
tests/Symfony/Tests/Bridge/Doctrine/Form/DoctrineOrmTestCase.php

@@ -11,6 +11,10 @@
 
 namespace Symfony\Tests\Bridge\Doctrine\Form;
 
+use Doctrine\Common\Annotations\AnnotationReader;
+
+use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
+
 use Doctrine\ORM\EntityManager;
 use Symfony\Tests\Component\Form\Extension\Core\Type\TestCase;
 
@@ -32,7 +36,7 @@ abstract class DoctrineOrmTestCase extends \PHPUnit_Framework_TestCase
         $config->setAutoGenerateProxyClasses(true);
         $config->setProxyDir(\sys_get_temp_dir());
         $config->setProxyNamespace('SymfonyTests\Doctrine');
-        $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver($paths));
+        $config->setMetadataDriverImpl(new AnnotationDriver(new AnnotationReader()));
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
 

+ 7 - 7
tests/Symfony/Tests/Component/Validator/ValidatorFactoryTest.php

@@ -11,7 +11,7 @@
 
 namespace Symfony\Tests\Component\Validator;
 
-use Doctrine\Common\Annotations\Reader;
+use Doctrine\Common\Annotations\AnnotationReader;
 use Symfony\Component\Validator\Validator;
 use Symfony\Component\Validator\ValidatorContext;
 use Symfony\Component\Validator\ValidatorFactory;
@@ -76,14 +76,14 @@ class ValidatorFactoryTest extends \PHPUnit_Framework_TestCase
 
     public function testBuildDefaultFromAnnotations()
     {
-        if (!class_exists('Doctrine\Common\Annotations\Reader')) {
+        if (!class_exists('Doctrine\Common\Annotations\AnnotationReader')) {
             $this->markTestSkipped('Annotations is required for this test');
         }
         $factory = ValidatorFactory::buildDefault();
 
         $context = new ValidatorContext();
         $context
-            ->setClassMetadataFactory(new ClassMetadataFactory(new AnnotationLoader(new Reader())))
+            ->setClassMetadataFactory(new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())))
             ->setConstraintValidatorFactory(new ConstraintValidatorFactory());
 
         $this->assertEquals(new ValidatorFactory($context), $factory);
@@ -91,14 +91,14 @@ class ValidatorFactoryTest extends \PHPUnit_Framework_TestCase
 
     public function testBuildDefaultFromAnnotationsWithCustomNamespaces()
     {
-        if (!class_exists('Doctrine\Common\Annotations\Reader')) {
+        if (!class_exists('Doctrine\Common\Annotations\AnnotationReader')) {
             $this->markTestSkipped('Annotations is required for this test');
         }
         $factory = ValidatorFactory::buildDefault(array(), true);
 
         $context = new ValidatorContext();
         $context
-            ->setClassMetadataFactory(new ClassMetadataFactory(new AnnotationLoader(new Reader())))
+            ->setClassMetadataFactory(new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())))
             ->setConstraintValidatorFactory(new ConstraintValidatorFactory());
 
         $this->assertEquals(new ValidatorFactory($context), $factory);
@@ -145,7 +145,7 @@ class ValidatorFactoryTest extends \PHPUnit_Framework_TestCase
 
     public function testBuildDefaultFromMultipleLoaders()
     {
-        if (!class_exists('Doctrine\Common\Annotations\Reader')) {
+        if (!class_exists('Doctrine\Common\Annotations\AnnotationReader')) {
             $this->markTestSkipped('Annotations is required for this test');
         }
         $xmlPath = __DIR__.'/Mapping/Loader/constraint-mapping.xml';
@@ -155,7 +155,7 @@ class ValidatorFactoryTest extends \PHPUnit_Framework_TestCase
         $chain = new LoaderChain(array(
             new XmlFilesLoader(array($xmlPath)),
             new YamlFilesLoader(array($yamlPath)),
-            new AnnotationLoader(new Reader()),
+            new AnnotationLoader(new AnnotationReader()),
             new StaticMethodLoader('loadMetadata'),
         ));