From 879242cdf5466f139b89c56fed71cd5d93fef39d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 8 Jun 2011 08:36:14 +0200 Subject: [PATCH] moved some Doctrine classes from the bundle to the bridge --- .../Doctrine}/Annotations/IndexedReader.php | 2 +- .../CacheWarmer/ProxyCacheWarmer.php | 2 +- .../DataCollector/DoctrineDataCollector.php | 4 ++-- .../Doctrine}/Logger/DbalLogger.php | 2 +- .../Doctrine}/Mapping/Driver/XmlDriver.php | 2 +- .../Doctrine}/Mapping/Driver/YamlDriver.php | 2 +- .../DoctrineBundle/Resources/config/dbal.xml | 4 ++-- .../DoctrineBundle/Resources/config/orm.xml | 8 +++---- .../DoctrineBundle/Tests/ContainerTest.php | 4 ++-- .../AbstractDoctrineExtensionTest.php | 4 ++-- .../Doctrine/Form/DoctrineOrmTestCase.php | 6 +---- .../Mapping/Driver/AbstractDriverTest.php | 24 +++++++++---------- .../Mapping/Driver/XmlDriverTest.php | 4 ++-- .../Mapping/Driver/YamlDriverTest.php | 4 ++-- 14 files changed, 34 insertions(+), 38 deletions(-) rename src/Symfony/{Bundle/DoctrineBundle => Bridge/Doctrine}/Annotations/IndexedReader.php (97%) rename src/Symfony/{Bundle/DoctrineBundle => Bridge/Doctrine}/CacheWarmer/ProxyCacheWarmer.php (97%) rename src/Symfony/{Bundle/DoctrineBundle => Bridge/Doctrine}/DataCollector/DoctrineDataCollector.php (94%) rename src/Symfony/{Bundle/DoctrineBundle => Bridge/Doctrine}/Logger/DbalLogger.php (96%) rename src/Symfony/{Bundle/DoctrineBundle => Bridge/Doctrine}/Mapping/Driver/XmlDriver.php (98%) rename src/Symfony/{Bundle/DoctrineBundle => Bridge/Doctrine}/Mapping/Driver/YamlDriver.php (98%) rename {src/Symfony/Bundle/DoctrineBundle/Tests => tests/Symfony/Tests/Bridge/Doctrine}/Mapping/Driver/AbstractDriverTest.php (78%) rename {src/Symfony/Bundle/DoctrineBundle/Tests => tests/Symfony/Tests/Bridge/Doctrine}/Mapping/Driver/XmlDriverTest.php (82%) rename {src/Symfony/Bundle/DoctrineBundle/Tests => tests/Symfony/Tests/Bridge/Doctrine}/Mapping/Driver/YamlDriverTest.php (82%) diff --git a/src/Symfony/Bundle/DoctrineBundle/Annotations/IndexedReader.php b/src/Symfony/Bridge/Doctrine/Annotations/IndexedReader.php similarity index 97% rename from src/Symfony/Bundle/DoctrineBundle/Annotations/IndexedReader.php rename to src/Symfony/Bridge/Doctrine/Annotations/IndexedReader.php index 1332488bd8f6..ed371bb4e687 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Annotations/IndexedReader.php +++ b/src/Symfony/Bridge/Doctrine/Annotations/IndexedReader.php @@ -9,7 +9,7 @@ * with this source code in the file LICENSE. */ -namespace Symfony\Bundle\DoctrineBundle\Annotations; +namespace Symfony\Bridge\Doctrine\Annotations; use Doctrine\Common\Annotations\Reader; diff --git a/src/Symfony/Bundle/DoctrineBundle/CacheWarmer/ProxyCacheWarmer.php b/src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php similarity index 97% rename from src/Symfony/Bundle/DoctrineBundle/CacheWarmer/ProxyCacheWarmer.php rename to src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php index 955dd6ca29f7..7130c0249a8e 100644 --- a/src/Symfony/Bundle/DoctrineBundle/CacheWarmer/ProxyCacheWarmer.php +++ b/src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Bundle\DoctrineBundle\CacheWarmer; +namespace Symfony\Bridge\Doctrine\CacheWarmer; use Symfony\Bridge\Doctrine\RegistryInterface; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; diff --git a/src/Symfony/Bundle/DoctrineBundle/DataCollector/DoctrineDataCollector.php b/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php similarity index 94% rename from src/Symfony/Bundle/DoctrineBundle/DataCollector/DoctrineDataCollector.php rename to src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php index 948dfa4ec908..ba8c3266379b 100644 --- a/src/Symfony/Bundle/DoctrineBundle/DataCollector/DoctrineDataCollector.php +++ b/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php @@ -9,12 +9,12 @@ * file that was distributed with this source code. */ -namespace Symfony\Bundle\DoctrineBundle\DataCollector; +namespace Symfony\Bridge\Doctrine\DataCollector; use Symfony\Component\HttpKernel\DataCollector\DataCollector; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Bundle\DoctrineBundle\Logger\DbalLogger; +use Symfony\Bridge\Doctrine\Logger\DbalLogger; use Symfony\Bridge\Doctrine\RegistryInterface; /** diff --git a/src/Symfony/Bundle/DoctrineBundle/Logger/DbalLogger.php b/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php similarity index 96% rename from src/Symfony/Bundle/DoctrineBundle/Logger/DbalLogger.php rename to src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php index 9373780019a2..9553e1a2c7bf 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Logger/DbalLogger.php +++ b/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Bundle\DoctrineBundle\Logger; +namespace Symfony\Bridge\Doctrine\Logger; use Symfony\Component\HttpKernel\Log\LoggerInterface; use Doctrine\DBAL\Logging\DebugStack; diff --git a/src/Symfony/Bundle/DoctrineBundle/Mapping/Driver/XmlDriver.php b/src/Symfony/Bridge/Doctrine/Mapping/Driver/XmlDriver.php similarity index 98% rename from src/Symfony/Bundle/DoctrineBundle/Mapping/Driver/XmlDriver.php rename to src/Symfony/Bridge/Doctrine/Mapping/Driver/XmlDriver.php index 3dd3657bc1d7..3b2b7c1f3688 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Mapping/Driver/XmlDriver.php +++ b/src/Symfony/Bridge/Doctrine/Mapping/Driver/XmlDriver.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Bundle\DoctrineBundle\Mapping\Driver; +namespace Symfony\Bridge\Doctrine\Mapping\Driver; use Doctrine\ORM\Mapping\MappingException; use Doctrine\ORM\Mapping\Driver\XmlDriver as BaseXmlDriver; diff --git a/src/Symfony/Bundle/DoctrineBundle/Mapping/Driver/YamlDriver.php b/src/Symfony/Bridge/Doctrine/Mapping/Driver/YamlDriver.php similarity index 98% rename from src/Symfony/Bundle/DoctrineBundle/Mapping/Driver/YamlDriver.php rename to src/Symfony/Bridge/Doctrine/Mapping/Driver/YamlDriver.php index b6c0f501c13e..f303580f4d4b 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Mapping/Driver/YamlDriver.php +++ b/src/Symfony/Bridge/Doctrine/Mapping/Driver/YamlDriver.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Bundle\DoctrineBundle\Mapping\Driver; +namespace Symfony\Bridge\Doctrine\Mapping\Driver; use Doctrine\ORM\Mapping\MappingException; use Doctrine\ORM\Mapping\Driver\YamlDriver as BaseYamlDriver; diff --git a/src/Symfony/Bundle/DoctrineBundle/Resources/config/dbal.xml b/src/Symfony/Bundle/DoctrineBundle/Resources/config/dbal.xml index 9471976be901..42139afb5981 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Resources/config/dbal.xml +++ b/src/Symfony/Bundle/DoctrineBundle/Resources/config/dbal.xml @@ -7,9 +7,9 @@ Doctrine\DBAL\Connection Doctrine\DBAL\Logging\DebugStack - Symfony\Bundle\DoctrineBundle\Logger\DbalLogger + Symfony\Bridge\Doctrine\Logger\DbalLogger Doctrine\DBAL\Configuration - Symfony\Bundle\DoctrineBundle\DataCollector\DoctrineDataCollector + Symfony\Bridge\Doctrine\DataCollector\DoctrineDataCollector Doctrine\Common\EventManager Symfony\Bundle\DoctrineBundle\ConnectionFactory Doctrine\DBAL\Event\Listeners\MysqlSessionInit diff --git a/src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml b/src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml index 539490ed2ab6..1687a7924c0c 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml +++ b/src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml @@ -20,14 +20,14 @@ Doctrine\ORM\Mapping\Driver\DriverChain Doctrine\ORM\Mapping\Driver\AnnotationDriver - Symfony\Bundle\DoctrineBundle\Annotations\IndexedReader - Symfony\Bundle\DoctrineBundle\Mapping\Driver\XmlDriver - Symfony\Bundle\DoctrineBundle\Mapping\Driver\YamlDriver + Symfony\Bridge\Doctrine\Annotations\IndexedReader + Symfony\Bridge\Doctrine\Mapping\Driver\XmlDriver + Symfony\Bridge\Doctrine\Mapping\Driver\YamlDriver Doctrine\ORM\Mapping\Driver\PHPDriver Doctrine\ORM\Mapping\Driver\StaticPHPDriver - Symfony\Bundle\DoctrineBundle\CacheWarmer\ProxyCacheWarmer + Symfony\Bridge\Doctrine\CacheWarmer\ProxyCacheWarmer Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser diff --git a/src/Symfony/Bundle/DoctrineBundle/Tests/ContainerTest.php b/src/Symfony/Bundle/DoctrineBundle/Tests/ContainerTest.php index b042b5f05c8e..e2e6b6072545 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Tests/ContainerTest.php +++ b/src/Symfony/Bundle/DoctrineBundle/Tests/ContainerTest.php @@ -20,7 +20,7 @@ public function testContainer() $container = $this->createYamlBundleTestContainer(); $this->assertInstanceOf('Doctrine\DBAL\Logging\DebugStack', $container->get('doctrine.dbal.logger.debug')); $this->assertInstanceOf('Doctrine\DBAL\Logging\DebugStack', $container->get('doctrine.dbal.logger')); - $this->assertInstanceOf('Symfony\Bundle\DoctrineBundle\DataCollector\DoctrineDataCollector', $container->get('data_collector.doctrine')); + $this->assertInstanceOf('Symfony\Bridge\Doctrine\DataCollector\DoctrineDataCollector', $container->get('data_collector.doctrine')); $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')); @@ -36,7 +36,7 @@ public function testContainer() $this->assertInstanceOf('Doctrine\Common\EventManager', $container->get('doctrine.orm.default_entity_manager.event_manager')); $this->assertInstanceOf('Doctrine\Common\EventManager', $container->get('doctrine.dbal.event_manager')); $this->assertInstanceOf('Doctrine\DBAL\Event\Listeners\MysqlSessionInit', $container->get('doctrine.dbal.default_connection.events.mysqlsessioninit')); - $this->assertInstanceOf('Symfony\Bundle\DoctrineBundle\CacheWarmer\ProxyCacheWarmer', $container->get('doctrine.orm.proxy_cache_warmer')); + $this->assertInstanceOf('Symfony\Bridge\Doctrine\CacheWarmer\ProxyCacheWarmer', $container->get('doctrine.orm.proxy_cache_warmer')); $this->assertInstanceOf('Symfony\Bundle\DoctrineBundle\Registry', $container->get('doctrine')); $this->assertInstanceOf('Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator', $container->get('doctrine.orm.validator.unique')); diff --git a/src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php b/src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php index 5dc4f2ce2a85..5567cd79efc2 100755 --- a/src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php +++ b/src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php @@ -121,8 +121,8 @@ public function testDependencyInjectionConfigurationDefaults() $this->assertEquals('Doctrine\Common\Cache\XcacheCache', $container->getParameter('doctrine.orm.cache.xcache.class')); $this->assertEquals('Doctrine\ORM\Mapping\Driver\DriverChain', $container->getParameter('doctrine.orm.metadata.driver_chain.class')); $this->assertEquals('Doctrine\ORM\Mapping\Driver\AnnotationDriver', $container->getParameter('doctrine.orm.metadata.annotation.class')); - $this->assertEquals('Symfony\Bundle\DoctrineBundle\Mapping\Driver\XmlDriver', $container->getParameter('doctrine.orm.metadata.xml.class')); - $this->assertEquals('Symfony\Bundle\DoctrineBundle\Mapping\Driver\YamlDriver', $container->getParameter('doctrine.orm.metadata.yml.class')); + $this->assertEquals('Symfony\Bridge\Doctrine\Mapping\Driver\XmlDriver', $container->getParameter('doctrine.orm.metadata.xml.class')); + $this->assertEquals('Symfony\Bridge\Doctrine\Mapping\Driver\YamlDriver', $container->getParameter('doctrine.orm.metadata.yml.class')); $config = array( 'proxy_namespace' => 'MyProxies', diff --git a/tests/Symfony/Tests/Bridge/Doctrine/Form/DoctrineOrmTestCase.php b/tests/Symfony/Tests/Bridge/Doctrine/Form/DoctrineOrmTestCase.php index e3b8ebac1023..d4f0266ccfe4 100644 --- a/tests/Symfony/Tests/Bridge/Doctrine/Form/DoctrineOrmTestCase.php +++ b/tests/Symfony/Tests/Bridge/Doctrine/Form/DoctrineOrmTestCase.php @@ -11,14 +11,10 @@ namespace Symfony\Tests\Bridge\Doctrine\Form; -use Symfony\Bundle\DoctrineBundle\Annotations\IndexedReader; - +use Symfony\Bridge\Doctrine\Annotations\IndexedReader; use Doctrine\Common\Annotations\AnnotationReader; - use Doctrine\ORM\Mapping\Driver\AnnotationDriver; - use Doctrine\ORM\EntityManager; -use Symfony\Tests\Component\Form\Extension\Core\Type\TestCase; abstract class DoctrineOrmTestCase extends \PHPUnit_Framework_TestCase { diff --git a/src/Symfony/Bundle/DoctrineBundle/Tests/Mapping/Driver/AbstractDriverTest.php b/tests/Symfony/Tests/Bridge/Doctrine/Mapping/Driver/AbstractDriverTest.php similarity index 78% rename from src/Symfony/Bundle/DoctrineBundle/Tests/Mapping/Driver/AbstractDriverTest.php rename to tests/Symfony/Tests/Bridge/Doctrine/Mapping/Driver/AbstractDriverTest.php index 2326536450a6..5f7f90ac2fec 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Tests/Mapping/Driver/AbstractDriverTest.php +++ b/tests/Symfony/Tests/Bridge/Doctrine/Mapping/Driver/AbstractDriverTest.php @@ -9,57 +9,57 @@ * with this source code in the file LICENSE. */ -namespace Symfony\Bundle\DoctrineBundle\Tests\Mapping\Driver; +namespace Symfony\Tests\Bridge\Doctrine\Mapping\Driver; abstract class AbstractDriverTest extends \PHPUnit_Framework_TestCase { public function testFindMappingFile() { $driver = $this->getDriver(array( - 'MyNamespace\MyBundle\EntityFoo' => 'foo', - 'MyNamespace\MyBundle\Entity' => $this->dir, + 'MyNamespace\MySubnamespace\EntityFoo' => 'foo', + 'MyNamespace\MySubnamespace\Entity' => $this->dir, )); touch($filename = $this->dir.'/Foo'.$this->getFileExtension()); - $this->assertEquals($filename, $this->invoke($driver, '_findMappingFile', array('MyNamespace\MyBundle\Entity\Foo'))); + $this->assertEquals($filename, $this->invoke($driver, '_findMappingFile', array('MyNamespace\MySubnamespace\Entity\Foo'))); } public function testFindMappingFileInSubnamespace() { $driver = $this->getDriver(array( - 'MyNamespace\MyBundle\Entity' => $this->dir, + 'MyNamespace\MySubnamespace\Entity' => $this->dir, )); touch($filename = $this->dir.'/Foo.Bar'.$this->getFileExtension()); - $this->assertEquals($filename, $this->invoke($driver, '_findMappingFile', array('MyNamespace\MyBundle\Entity\Foo\Bar'))); + $this->assertEquals($filename, $this->invoke($driver, '_findMappingFile', array('MyNamespace\MySubnamespace\Entity\Foo\Bar'))); } public function testFindMappingFileNamespacedFoundFileNotFound() { $this->setExpectedException( 'Doctrine\ORM\Mapping\MappingException', - "No mapping file found named '".$this->dir."/Foo".$this->getFileExtension()."' for class 'MyNamespace\MyBundle\Entity\Foo'." + "No mapping file found named '".$this->dir."/Foo".$this->getFileExtension()."' for class 'MyNamespace\MySubnamespace\Entity\Foo'." ); $driver = $this->getDriver(array( - 'MyNamespace\MyBundle\Entity' => $this->dir, + 'MyNamespace\MySubnamespace\Entity' => $this->dir, )); - $this->invoke($driver, '_findMappingFile', array('MyNamespace\MyBundle\Entity\Foo')); + $this->invoke($driver, '_findMappingFile', array('MyNamespace\MySubnamespace\Entity\Foo')); } public function testFindMappingNamespaceNotFound() { $this->setExpectedException( 'Doctrine\ORM\Mapping\MappingException', - "No mapping file found named 'Foo".$this->getFileExtension()."' for class 'MyOtherNamespace\MyBundle\Entity\Foo'." + "No mapping file found named 'Foo".$this->getFileExtension()."' for class 'MyOtherNamespace\MySubnamespace\Entity\Foo'." ); $driver = $this->getDriver(array( - 'MyNamespace\MyBundle\Entity' => $this->dir, + 'MyNamespace\MySubnamespace\Entity' => $this->dir, )); - $this->invoke($driver, '_findMappingFile', array('MyOtherNamespace\MyBundle\Entity\Foo')); + $this->invoke($driver, '_findMappingFile', array('MyOtherNamespace\MySubnamespace\Entity\Foo')); } protected function setUp() diff --git a/src/Symfony/Bundle/DoctrineBundle/Tests/Mapping/Driver/XmlDriverTest.php b/tests/Symfony/Tests/Bridge/Doctrine/Mapping/Driver/XmlDriverTest.php similarity index 82% rename from src/Symfony/Bundle/DoctrineBundle/Tests/Mapping/Driver/XmlDriverTest.php rename to tests/Symfony/Tests/Bridge/Doctrine/Mapping/Driver/XmlDriverTest.php index 2d93b1703a83..a0ac944daeed 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Tests/Mapping/Driver/XmlDriverTest.php +++ b/tests/Symfony/Tests/Bridge/Doctrine/Mapping/Driver/XmlDriverTest.php @@ -9,9 +9,9 @@ * with this source code in the file LICENSE. */ -namespace Symfony\Bundle\DoctrineBundle\Tests\Mapping\Driver; +namespace Symfony\Tests\Bridge\Doctrine\Mapping\Driver; -use Symfony\Bundle\DoctrineBundle\Mapping\Driver\XmlDriver; +use Symfony\Bridge\Doctrine\Mapping\Driver\XmlDriver; class XmlDriverTest extends AbstractDriverTest { diff --git a/src/Symfony/Bundle/DoctrineBundle/Tests/Mapping/Driver/YamlDriverTest.php b/tests/Symfony/Tests/Bridge/Doctrine/Mapping/Driver/YamlDriverTest.php similarity index 82% rename from src/Symfony/Bundle/DoctrineBundle/Tests/Mapping/Driver/YamlDriverTest.php rename to tests/Symfony/Tests/Bridge/Doctrine/Mapping/Driver/YamlDriverTest.php index dab2ea93aa85..95f616601ab1 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Tests/Mapping/Driver/YamlDriverTest.php +++ b/tests/Symfony/Tests/Bridge/Doctrine/Mapping/Driver/YamlDriverTest.php @@ -9,9 +9,9 @@ * with this source code in the file LICENSE. */ -namespace Symfony\Bundle\DoctrineBundle\Tests\Mapping\Driver; +namespace Symfony\Tests\Bridge\Doctrine\Mapping\Driver; -use Symfony\Bundle\DoctrineBundle\Mapping\Driver\YamlDriver; +use Symfony\Bridge\Doctrine\Mapping\Driver\YamlDriver; class YamlDriverTest extends AbstractDriverTest {