top-think / top-think/think-orm
Model::suffix()使用报错
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 437
- Forks
- 188
- PR merge metrics
- No merged PRs in 30d
Description
使用 Model::suffix() 会触发错误
使用 Model::suffix() 会导致触发器那里自带的设置匿名函数使用的不是主动添加后缀后的表名称而还是模型变量里设置的原始表名称,如果有主表而使用
suffix 方法就没有问题,但是单独的没有主表就会报错
版本 think-orm 2.0.35
\think\Model: 242
if (!empty(static::$maker)) {
foreach (static::$maker as $maker) {
call_user_func($maker, $this);
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at think\Model around line 242 and reproduce the failure with Model::suffix() on a model without a main table, using think-orm 2.0.35. Trace the trigger's anonymous maker function and compare the table name it receives with the actively suffixed name; done means the trigger uses the suffixed table name in this case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100