Skip to content

Commit

Permalink
优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
limingxinleo committed Jun 30, 2024
1 parent b91e6ba commit 5cfdb69
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Command/GenCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ public function createModel(string $model, string $index): int
$mapping = $mapping[$index]['mappings']['properties'];
$properties = '';
foreach ($mapping as $property => $item) {
$properties .= "'{$property}' => ['type' => '{$item['type']}']," . PHP_EOL;
$properties .= "'{$property}' => [";
foreach ($item as $key => $value) {
$properties .= "'{$key}' => '{$value}',";
}
$properties .= '],' . PHP_EOL;
}

$code = str_replace('__MAPPING__', $properties, $code);
Expand Down

0 comments on commit 5cfdb69

Please sign in to comment.