top-think / top-think/think-orm
使用Model::suffix方法无效。不能添加后缀
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 437
- Forks
- 188
- PR merge metrics
- No merged PRs in 30d
Description
thinkphp-orm: 4.0.49
代码:
ProductModel::suffix($this->lang)->field("{$field}, video_cover, video_url")->where(['status' => 1])->order("id DESC")->find();
运行报错,提示 Shop.sp_product表不存在。后缀_cn 没有添加上去。所以提示表不存在,
如果再ProductModel.php文件里使用
protected $suffix = "_cn";
这样写死就可以。
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 with the ProductModel.php definition and the Model::suffix call shown in the report, then reproduce the query using the provided example. Trace how the suffix reaches table resolution and verify that the generated table name includes _cn instead of reporting Shop.sp_product as missing.
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
- 35/100