top-think / top-think/think-orm
设置了软删除字段的类型,但是输出还是字符串
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 437
- Forks
- 188
- PR merge metrics
- No merged PRs in 30d
Description
模型设置了软删除字段
protected function init(): void
{
// 模型初始化
$this->setOption('deleteTime', 'del_time');
$this->setOption('defaultSoftDelete', 0);
$this->setOption('type', ['del_time'=>'int']);
}
使用字段
$model->del_time
结果是字符串,导致之前写的判断是否被删除都变无效了。
看了之前版本的文档说软删除字段使用时间戳,新版本改成时间类型?
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
No source file or test is named. Start by reproducing the model configuration with the del_time soft-delete field and inspect how the ORM applies field type casting when the field is accessed. Done means the configured type is respected and soft-delete checks no longer receive an unexpected string.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100