Created
December 13, 2015 18:48
-
-
Save doctrinebot/1680a98d3813bbcd33d1 to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DDC-64 - https://github.com/doctrine/doctrine2/issues/5149
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: Type.php | |
=================================================================== | |
--- Type.php (revision 6574) | |
+++ Type.php (working copy) | |
@@ -42,7 +42,8 @@ | |
'date' => 'Doctrine\DBAL\Types\DateType', | |
'time' => 'Doctrine\DBAL\Types\TimeType', | |
'decimal' => 'Doctrine\DBAL\Types\DecimalType', | |
- 'double' => 'Doctrine\DBAL\Types\DoubleType' | |
+ 'double' => 'Doctrine\DBAL\Types\DoubleType', | |
+ 'clob' => 'Doctrine\DBAL\Types\TextType' | |
); | |
/* Prevent instantiation and force use of the factory method. */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: ConvertDoctrine1Schema.php | |
=================================================================== | |
--- ConvertDoctrine1Schema.php (revision 6578) | |
+++ ConvertDoctrine1Schema.php (working copy) | |
@@ -45,6 +45,10 @@ | |
*/ | |
class ConvertDoctrine1Schema | |
{ | |
+ | |
+ /** The map of legacy column types */ | |
+ protected $_legacyTypeMap = array('clob' => 'text'); | |
+ | |
/** | |
* Constructor passes the directory or array of directories | |
* to convert the Doctrine 1 schema files from | |
@@ -144,12 +148,17 @@ | |
$column['type'] = $string; | |
} | |
if (preg_match("/([a-zA-Z]+)\(([0-9]+)\)/", $column['type'], $matches)) { | |
- $column['type'] = $matches[1]; | |
+ $column['type'] = strtolower($matches[1]); | |
$column['length'] = $matches[2]; | |
} | |
if ( ! isset($column['name'])) { | |
$column['name'] = $name; | |
+ } | |
+ // check if legacy column type (1.x) needs to be mapped to a 2.0 one | |
+ if (array_key_exists($column['type'], $this->_legacyTypeMap)) { | |
+ $column['type'] = $this->_legacyTypeMap[$column['type']]; | |
} | |
+ | |
$fieldMapping = array(); | |
if (isset($column['primary'])) { | |
$fieldMapping['id'] = true; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment