Skip to content

Instantly share code, notes, and snippets.

@doctrinebot
Created December 13, 2015 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doctrinebot/8df5a3985d02170a5f6b to your computer and use it in GitHub Desktop.
Save doctrinebot/8df5a3985d02170a5f6b to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DDC-72 - https://github.com/doctrine/doctrine2/issues/5233
Index: ConvertDoctrine1Schema.php
===================================================================
--- ConvertDoctrine1Schema.php (revision 6580)
+++ ConvertDoctrine1Schema.php (working copy)
@@ -143,6 +143,11 @@
$column = array();
$column['type'] = $string;
}
+ // check if a column alias was used (column_name as field_name)
+ if (preg_match("/(\w+)\sas\s(\w+)/i", $name, $matches)) {
+ $name = $matches[1];
+ $column['alias'] = $matches[2];
+ }
if (preg_match("/([a-zA-Z]+)\(([0-9]+)\)/", $column['type'], $matches)) {
$column['type'] = $matches[1];
$column['length'] = $matches[2];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment