top-think / top-think/think-orm
模型字段类型datetime自动转码问题
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 437
- Forks
- 188
- PR merge metrics
- No merged PRs in 30d
Description
$this->formatDateTime('Y-m-d H:i:s.u', $value);中第二个参数$value已经是timestamp了,是否要加第三个参数为true,否则执行到formatDateTime里的$dateTime = new DateTime($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
Start in src/model/concern/Attribute.php around line 427 and trace the call to formatDateTime, especially how the timestamp value reaches DateTime($time). Reproduce the datetime model-field case and verify that timestamp input is handled without an exception; add or update regression coverage if the repository provides a relevant test location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- database
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100