protected function getPropertiesFromTable($model)
{
$table = $model->getConnection()->getTablePrefix() . $model->getTable();
$schema = $model->getConnection()->getDoctrineSchemaManager($table);
$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);
}
$database = null;
if (strpos($table, '.')) {
list($database, $table) = explode('.', $table);
}
$columns = $schema->listTableColumns($table, $database);
if ($columns) {
foreach ($columns as $column) {
$name = $column->getName();
if (in_array($name, $model->getDates())) {
$type = 'datetime';
} else {
$type = $column->getType()->getName();
}
if (!($model->incrementing && $model->getKeyName() === $name) && $name !== $model::CREATED_AT && $name !== $model::UPDATED_AT) {
if (!method_exists($model, 'getDeletedAtColumn') || method_exists($model, 'getDeletedAtColumn') && $name !== $model->getDeletedAtColumn()) {
$this->setProperty($name, $type);
}
}
}
}
}