mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
allow a user to define the type overrides
This commit is contained in:
@@ -142,4 +142,17 @@ return array(
|
|||||||
*/
|
*/
|
||||||
'model_camel_case_properties' => false,
|
'model_camel_case_properties' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Property Casts
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Cast the given "real type" to the given "type".
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
'type_overrides' => array(
|
||||||
|
// 'integer' => 'int',
|
||||||
|
// 'boolean' => 'bool',
|
||||||
|
)
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -279,11 +279,24 @@ class ModelsCommand extends Command
|
|||||||
if (!isset($this->properties[$name])) {
|
if (!isset($this->properties[$name])) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
$this->properties[$name]['type'] = $realType;
|
$this->properties[$name]['type'] = $this->getTypeOverride($realType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the overide type for the give type.
|
||||||
|
*
|
||||||
|
* @param string $type
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function getTypeOverride($type)
|
||||||
|
{
|
||||||
|
$typeOverrides = $this->laravel['config']->get('ide-helper.type_overrides', array());
|
||||||
|
|
||||||
|
return isset($typeOverrides[$type]) ? $typeOverrides[$type] : $type;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the properties from the database table.
|
* Load the properties from the database table.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user