top-think / top-think/think-orm
withJoin生成SQL不带前缀
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 437
- Forks
- 188
- PR merge metrics
- No merged PRs in 30d
Description
THINKPHP 6.0.3
Order::withJoin([
'userInfo' => ['id', 'nick_name'],
'currency' => ['iname', 'an', 'pn', 'vn']
], 'LEFT')
->withCount(['subOrderCount' => function ($query, &$alias) {
$query->where('status', 'IN', '0,1,6');
$alias = 'sub_total';
}])
->withCount(['subOrderCount' => function ($query, &$alias) {
$query->where('status', 'IN', '3,4,7');
$alias = 'sub_cancel_total';
}])
->where($where)
->limit($pagetion['offsize'], $pagetion['limit'])
->order($pagetion['order'])
->select()
->toArray();
DB配置数据表前缀后, 执行以上语句生成SQL,字段部分不带前缀,数据库报错,withJoin方法生成语句没有自动增加表前缀
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 by reproducing the provided Think ORM 6.0.3 example with a configured table prefix, then trace the withJoin SQL generation path. The issue is done when the generated SQL prefixes the selected fields correctly and executes without the reported database error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100