refactor(admin): refactor model generation and improve array string handling
- Update CommonTool to fix array string formatting issue- Refactor model generation template to use getOptions method
This commit is contained in:
@@ -7,11 +7,14 @@ use app\common\model\TimeModel;
|
||||
class {{modelName}} extends TimeModel
|
||||
{
|
||||
|
||||
protected $name = "{{table}}";
|
||||
|
||||
protected $table = "{{prefix_table}}";
|
||||
|
||||
protected $deleteTime = {{deleteTime}};
|
||||
protected function getOptions(): array
|
||||
{
|
||||
return [
|
||||
'name' => "{{table}}",
|
||||
'table' => "{{prefix_table}}",
|
||||
'deleteTime' => {{deleteTime}},
|
||||
];
|
||||
}
|
||||
|
||||
public array $notes = {{selectArrays}};
|
||||
|
||||
|
||||
@@ -100,6 +100,9 @@ class CommonTool
|
||||
{
|
||||
$arrayString = str_replace('array (', '[', $arrayString);
|
||||
$arrayString = str_replace(')', ']', $arrayString);
|
||||
$arrayString = str_replace('=>
|
||||
[', '=> [', $arrayString);
|
||||
return $arrayString;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user