Merge branch 'hotfix/#1202-nullable-options-should-be-allowed'
Close #1202
This commit is contained in:
commit
1cc42d6a63
@ -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]);
|
||||
|
@ -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;
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user