top-think / top-think/think-orm

模型关联 字段类型decimal 无法被关联

Open
#661 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

modelA ID decimal(20,0) "1081294107383791623" 参考值
modelB UID decimal(20,0) "1081294107383791623"

$this->hasMany(modelB::class,"UID","ID" )

查询无数据 ,不知道是字段名为大写导致的,还是 字段类型导致,打印的SQL 能正常查询出来数据,用关联无法匹配出来

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 reported hasMany relation between modelA.ID and modelB.UID using decimal(20,0) values and uppercase field names. Compare the generated SQL with the relation result and verify whether the expected modelB record is returned; the issue is done when the cause is identified and the relation behaves correctly or the limitation is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.