top-think / top-think/think-orm

setSuffix 方法又有问题吗

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

// 模型定义
use think\Model;

class TestData extends Model
{
    protected function init(): void
    {
        $this->setOption('connection', 'data');
        $this->setOption('table', 'TestData_');
    }
}
// 模型使用
public function test()
{
    $testData = new TestData();
    $testData = $testData->setSuffix('1');
    // $testData->getTable(); 输出的是 TestData_ 而不是 TestData_1

}

数据库用的 MongoDB
think-orm 版本 v4.0.50

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 TestData model example against MongoDB with think-orm v4.0.50. Trace the setSuffix() and getTable() entry points and check whether the configured table name is updated after the suffix is set. Done means getTable() returns TestData_1 for the shown model.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, php
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.