Skip to content

Commit 83b838b

Browse files
houaiaiclaude
andcommitted
refactor: use init() hook instead of initialize()
- Use think-orm's built-in init() hook method - Simpler and more aligned with think-orm design - No need to call parent::initialize() Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d8a05af commit 83b838b

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/Model/RuleModel.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,11 @@ public function __construct(array $data = [], ?string $driver = null)
5050
}
5151

5252
/**
53-
* 模型初始化
53+
* 模型初始化(think-orm 提供的钩子方法)
5454
* @return void
5555
*/
56-
protected function initialize(): void
56+
protected function init(): void
5757
{
58-
parent::initialize();
59-
6058
// 使用 setOption 方法设置模型属性(think-orm 4.0 推荐方式)
6159
$this->setOption('connection', $this->config('database.connection') ?: '');
6260
$this->setOption('table', $this->config('database.rules_table'));

0 commit comments

Comments
 (0)