Adding custom DB types support for models

This commit is contained in:
Vladislav Rastrusny
2015-03-03 13:02:47 +03:00
parent 81b7febfc6
commit 8378f1bd67
2 changed files with 39 additions and 2 deletions
+8 -1
View File
@@ -217,7 +217,14 @@ class ModelsCommand extends Command
{
$table = $model->getConnection()->getTablePrefix() . $model->getTable();
$schema = $model->getConnection()->getDoctrineSchemaManager($table);
$schema->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
$databasePlatform = $schema->getDatabasePlatform();
$databasePlatform->registerDoctrineTypeMapping('enum', 'string');
$platformName = $databasePlatform->getName();
$customTypes = $this->laravel['config']->get("ide-helper.custom_db_types.{$platformName}", array());
foreach ($customTypes as $yourTypeName => $doctrineTypeName) {
$databasePlatform->registerDoctrineTypeMapping($yourTypeName, $doctrineTypeName);
}
$columns = $schema->listTableColumns($table);