Skip to content

Commit b84f620

Browse files
hi-noikiyzds-s
andauthored
Fixes the failure to generate files when certain words (category) are pluralized. (#63)
修复某些单词(category)复数情况下无法生成文件 --------- Co-authored-by: Zds <49744633+zds-s@users.noreply.github.com>
1 parent 365ecfb commit b84f620

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

CHANGELOG-2.0.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
- [#56](https://github.com/mineadmin/components/pull/56) Splitting modular components
1010
- [#58](https://github.com/mineadmin/components/pull/58) New base Secure Authentication Component
1111
- [#59](https://github.com/mineadmin/components/pull/59) Add components for secure access control
12-
- - [#61](https://github.com/mineadmin/components/pull/61) Provide associative access to exported path attributes
12+
- [#61](https://github.com/mineadmin/components/pull/61) Provide associative access to exported path attributes
13+
- [#63](https://github.com/mineadmin/components/pull/63) Fixes the failure to generate files when certain words (category) are pluralized.

CHANGELOG-2.0.zh_CN.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
- [#56](https://github.com/mineadmin/components/pull/56) 拆分`模块化`组件
1010
- [#58](https://github.com/mineadmin/components/pull/58) 新增基础的 安全认证组件
1111
- [#59](https://github.com/mineadmin/components/pull/59) 添加安全访问控制组件
12-
- [#61](https://github.com/mineadmin/components/pull/61) 为导出 path 属性提供关联访问方式
12+
- [#61](https://github.com/mineadmin/components/pull/61) 为导出 path 属性提供关联访问方式
13+
- [#63](https://github.com/mineadmin/components/pull/63) 修复某些单词(category)复数情况下无法生成文件

src/mine-generator/src/ModelGenerator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public function generator(): void
106106

107107
if ($application->run($input, $output) === 0) {
108108
// 对模型文件处理
109+
$modelName = \Hyperf\Stringable\Str::singular($modelName);
109110
if ($modelName[strlen($modelName) - 1] == 's' && $modelName[strlen($modelName) - 2] != 's') {
110111
$oldName = Str::substr($modelName, 0, strlen($modelName) - 1);
111112
$oldPath = BASE_PATH . "/app/{$module}/Model/{$oldName}.php";

0 commit comments

Comments
 (0)