Skip to content

Commit

Permalink
moved some Doctrine classes from the bundle to the bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jun 8, 2011
1 parent fbf3695 commit 879242c
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 38 deletions.
Expand Up @@ -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;

Expand Down
Expand Up @@ -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;
Expand Down
Expand Up @@ -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;

/**
Expand Down
Expand Up @@ -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;
Expand Down
Expand Up @@ -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;
Expand Down
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bundle/DoctrineBundle/Resources/config/dbal.xml
Expand Up @@ -7,9 +7,9 @@
<parameters>
<parameter key="doctrine.dbal.connection.class">Doctrine\DBAL\Connection</parameter>
<parameter key="doctrine.dbal.logger.debug.class">Doctrine\DBAL\Logging\DebugStack</parameter>
<parameter key="doctrine.dbal.logger.class">Symfony\Bundle\DoctrineBundle\Logger\DbalLogger</parameter>
<parameter key="doctrine.dbal.logger.class">Symfony\Bridge\Doctrine\Logger\DbalLogger</parameter>
<parameter key="doctrine.dbal.configuration.class">Doctrine\DBAL\Configuration</parameter>
<parameter key="doctrine.data_collector.class">Symfony\Bundle\DoctrineBundle\DataCollector\DoctrineDataCollector</parameter>
<parameter key="doctrine.data_collector.class">Symfony\Bridge\Doctrine\DataCollector\DoctrineDataCollector</parameter>
<parameter key="doctrine.dbal.connection.event_manager.class">Doctrine\Common\EventManager</parameter>
<parameter key="doctrine.dbal.connection_factory.class">Symfony\Bundle\DoctrineBundle\ConnectionFactory</parameter>
<parameter key="doctrine.dbal.events.mysql_session_init.class">Doctrine\DBAL\Event\Listeners\MysqlSessionInit</parameter>
Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml
Expand Up @@ -20,14 +20,14 @@
<!-- 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\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.annotation_reader.class">Symfony\Bridge\Doctrine\Annotations\IndexedReader</parameter>
<parameter key="doctrine.orm.metadata.xml.class">Symfony\Bridge\Doctrine\Mapping\Driver\XmlDriver</parameter>
<parameter key="doctrine.orm.metadata.yml.class">Symfony\Bridge\Doctrine\Mapping\Driver\YamlDriver</parameter>
<parameter key="doctrine.orm.metadata.php.class">Doctrine\ORM\Mapping\Driver\PHPDriver</parameter>
<parameter key="doctrine.orm.metadata.staticphp.class">Doctrine\ORM\Mapping\Driver\StaticPHPDriver</parameter>

<!-- cache warmer -->
<parameter key="doctrine.orm.proxy_cache_warmer.class">Symfony\Bundle\DoctrineBundle\CacheWarmer\ProxyCacheWarmer</parameter>
<parameter key="doctrine.orm.proxy_cache_warmer.class">Symfony\Bridge\Doctrine\CacheWarmer\ProxyCacheWarmer</parameter>

<!-- form field factory guesser -->
<parameter key="form.type_guesser.doctrine.class">Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser</parameter>
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bundle/DoctrineBundle/Tests/ContainerTest.php
Expand Up @@ -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'));
Expand All @@ -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'));

Expand Down
Expand Up @@ -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',
Expand Down
Expand Up @@ -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
{
Expand Down
Expand Up @@ -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()
Expand Down
Expand Up @@ -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
{
Expand Down
Expand Up @@ -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
{
Expand Down

0 comments on commit 879242c

Please sign in to comment.