Skip to content

Commit 67ebad3

Browse files
author
José Nicodemos Maia Neto
committed
- Trailling comma from doctrine.php config file
- Removed Mapping Types test because Mock Connection is needed - Adjusting documentation type from EntityManagerFactoryTest::$connection - Removing erroneous Database Type verification on EntityManagerFactory::registerMappingTypes
1 parent 0662f19 commit 67ebad3

File tree

3 files changed

+4
-26
lines changed

3 files changed

+4
-26
lines changed

config/doctrine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
*/
7676
'mapping_types' => [
7777
//'enum' => 'string'
78-
],
78+
]
7979
]
8080
],
8181
/*
@@ -106,7 +106,7 @@
106106
| Doctrine custom types
107107
|--------------------------------------------------------------------------
108108
|
109-
| Create a custom Local Type
109+
| Create a custom or override a Doctrine Type
110110
|--------------------------------------------------------------------------
111111
*/
112112
'custom_types' => [

src/EntityManagerFactory.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -383,13 +383,9 @@ protected function getConnectionDriver(array $settings = [])
383383
*/
384384
protected function registerMappingTypes(array $settings = [], EntityManagerInterface $manager)
385385
{
386-
$platform = $manager->getConnection()->getDatabasePlatform();
387-
388386
foreach (array_get($settings, 'mapping_types', []) as $dbType => $doctrineType) {
389-
// Throw DBALException if Database Type is not found.
390-
$platform->getDoctrineTypeMapping($dbType);
391387
// Throw DBALException if Doctrine Type is not found.
392-
$platform->registerDoctrineTypeMapping($dbType, $doctrineType);
388+
$manager->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping($dbType, $doctrineType);
393389
}
394390
}
395391
}

tests/EntityManagerFactoryTest.php

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class EntityManagerFactoryTest extends PHPUnit_Framework_TestCase
3838
protected $config;
3939

4040
/**
41-
* @var CacheManager
41+
* @var ConnectionManager
4242
*/
4343
protected $connection;
4444

@@ -463,24 +463,6 @@ public function test_can_set_repository_factory()
463463
$this->assertEntityManager($manager);
464464
}
465465

466-
public function test_can_register_mapping_types()
467-
{
468-
$this->disableDebugbar();
469-
$this->disableSecondLevelCaching();
470-
$this->disableCustomCacheNamespace();
471-
$this->disableCustomFunctions();
472-
$this->enableLaravelNamingStrategy();
473-
474-
$this->settings['mapping_types'] = [
475-
'enum' => 'string'
476-
];
477-
478-
$manager = $this->factory->create($this->settings);
479-
480-
$this->assertEntityManager($manager);
481-
$this->assertTrue(array_key_exists('string', $manager->getConnection()->getDatabasePlatform()->getDoctrineTypeMapping('enum')));
482-
}
483-
484466
/**
485467
* MOCKS
486468
*/

0 commit comments

Comments
 (0)