1
0
mirror of synced 2025-01-19 06:51:40 +03:00

Merge pull request #1123 from stof/patch-1

Fixed the structure of the reverse-engineered mapping
This commit is contained in:
Marco Pivetta 2014-08-30 04:19:55 +02:00
commit 6e79515a75
2 changed files with 7 additions and 7 deletions

View File

@ -407,7 +407,7 @@ class DatabaseDriver implements MappingDriver
case Type::STRING:
case Type::TEXT:
$fieldMapping['length'] = $column->getLength();
$fieldMapping['fixed'] = $column->getFixed();
$fieldMapping['options']['fixed'] = $column->getFixed();
break;
case Type::DECIMAL:
@ -419,18 +419,18 @@ class DatabaseDriver implements MappingDriver
case Type::INTEGER:
case Type::BIGINT:
case Type::SMALLINT:
$fieldMapping['unsigned'] = $column->getUnsigned();
$fieldMapping['options']['unsigned'] = $column->getUnsigned();
break;
}
// Comment
if (($comment = $column->getComment()) !== null) {
$fieldMapping['comment'] = $comment;
$fieldMapping['options']['comment'] = $comment;
}
// Default
if (($default = $column->getDefault()) !== null) {
$fieldMapping['default'] = $default;
$fieldMapping['options']['default'] = $default;
}
return $fieldMapping;

View File

@ -189,14 +189,14 @@ class DatabaseDriverTest extends DatabaseDriverTestCase
if ( ! $this->_em->getConnection()->getDatabasePlatform() instanceof PostgreSqlPlatform AND
! $this->_em->getConnection()->getDatabasePlatform() instanceof SQLServerPlatform) {
$this->assertArrayHasKey('columnUnsigned', $metadata->fieldMappings);
$this->assertTrue($metadata->fieldMappings['columnUnsigned']['unsigned']);
$this->assertTrue($metadata->fieldMappings['columnUnsigned']['options']['unsigned']);
}
$this->assertArrayHasKey('columnComment', $metadata->fieldMappings);
$this->assertEquals('test_comment', $metadata->fieldMappings['columnComment']['comment']);
$this->assertEquals('test_comment', $metadata->fieldMappings['columnComment']['options']['comment']);
$this->assertArrayHasKey('columnDefault', $metadata->fieldMappings);
$this->assertEquals('test_default', $metadata->fieldMappings['columnDefault']['default']);
$this->assertEquals('test_default', $metadata->fieldMappings['columnDefault']['options']['default']);
$this->assertArrayHasKey('columnDecimal', $metadata->fieldMappings);
$this->assertEquals(4, $metadata->fieldMappings['columnDecimal']['precision']);