diff --git a/lib/Doctrine/ORM/Tools/SchemaTool.php b/lib/Doctrine/ORM/Tools/SchemaTool.php index 2f90ad761..c359a7bdd 100644 --- a/lib/Doctrine/ORM/Tools/SchemaTool.php +++ b/lib/Doctrine/ORM/Tools/SchemaTool.php @@ -430,7 +430,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]); diff --git a/tests/Doctrine/Tests/Models/NullDefault/NullDefaultColumn.php b/tests/Doctrine/Tests/Models/NullDefault/NullDefaultColumn.php new file mode 100644 index 000000000..37545537f --- /dev/null +++ b/tests/Doctrine/Tests/Models/NullDefault/NullDefaultColumn.php @@ -0,0 +1,13 @@ +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); + } } /**