top-think / top-think/think-orm

能否完善下:关联统计方法兼容别名

Open
#484 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
437
Forks
188
PR merge metrics
No merged PRs in 30d

Description

能否完善关联统计相关方法兼容主表有别名的情况(无需独立语句查询):

  • 当使用hasWhere时,会给主表加上别名(简单类名)
  • withCountwithSum等方法则使用完整表名去比对检测

(topthink/think-orm v2.0.61 think orm)

QQ截图20230719124403
QQ截图20230719124442
QQ截图20230719124624

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the hasWhere, withCount, and withSum implementations in the ORM association query code, then reproduce the behavior described for a main table alias on think-orm v2.0.61. Done means association statistics recognize the alias consistently without requiring an independent query.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.