top-think / top-think/think-orm

v4.0.46版本使用withJoin查询,数据集中没有关联表的字段

Open
#789 3 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

同样的代码

$orderHandle = GoodsOrderTask::withJoin(["goodsOrder", "goodsOrderTaskSystem"], "LEFT")->find("J202507090190034");
dump($orderHandle->toArray());

v4.0.46没有关联表的信息

array:44 [
  "id" => "J202507090190034"
  "user_id" => 70
  "goods_order_id" => "X202507090190031"
  ···
  "create_time" => "2025-07-09 18:02:56"
  "update_time" => "2025-07-09 18:03:33"
  "delete_time" => null
]

v3.0.34能输出

array:46 [
  "id" => "J202507090190034"
  "user_id" => 70
  "goods_order_id" => "X202507090190031"
  ···
  "create_time" => "2025-07-09 18:02:56"
  "update_time" => "2025-07-09 18:03:33"
  "delete_time" => null
  "goodsOrder" => array:58 [
    "id" => "X202507090190031"
    ···
    "create_time" => "2025-07-09 18:02:44"
    "update_time" => "2025-07-09 18:03:33"
    "delete_time" => null
  ]
  "goodsOrderTaskSystem" => null
]

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 reproducing the GoodsOrderTask::withJoin query from the report with v4.0.46, then compare its result with v3.0.34. Trace the withJoin entry point and result conversion to determine why goodsOrder and goodsOrderTaskSystem are absent. Done means the associated fields are returned as shown in the older version.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.