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

Merge branch 'hotfix/#1202-nullable-options-should-be-allowed'

Close #1202
This commit is contained in:
Marco Pivetta 2014-12-08 01:35:11 +01:00
commit 1cc42d6a63
3 changed files with 31 additions and 1 deletions

View File

@ -433,7 +433,7 @@ class SchemaTool
$knownOptions = array('comment', 'unsigned', 'fixed', 'default');
foreach ($knownOptions as $knownOption) {
if ( isset($mapping['options'][$knownOption])) {
if (array_key_exists($knownOption, $mapping['options'])) {
$options[$knownOption] = $mapping['options'][$knownOption];
unset($mapping['options'][$knownOption]);

View File

@ -0,0 +1,13 @@
<?php
namespace Doctrine\Tests\Models\NullDefault;
/** @Entity */
class NullDefaultColumn
{
/** @Id @GeneratedValue @Column(type="integer") */
public $id;
/** @Column(options={"default":NULL}) */
public $nullDefault;
}

View File

@ -99,6 +99,23 @@ class SchemaToolTest extends \Doctrine\Tests\OrmTestCase
$this->assertEquals(count($classes), $listener->tableCalls);
$this->assertTrue($listener->schemaCalled);
}
public function testNullDefaultNotAddedToCustomSchemaOptions()
{
$em = $this->_getTestEntityManager();
$schemaTool = new SchemaTool($em);
$classes = array(
$em->getClassMetadata('Doctrine\Tests\Models\NullDefault\NullDefaultColumn'),
);
$customSchemaOptions = $schemaTool->getSchemaFromMetadata($classes)
->getTable('NullDefaultColumn')
->getColumn('nullDefault')
->getCustomSchemaOptions();
$this->assertSame(array(), $customSchemaOptions);
}
}
/**