top-think / top-think/think-orm
[Bug] 多对多关系时无法正确 new Pivot 对象
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 437
- Forks
- 188
- PR merge metrics
- No merged PRs in 30d
Description
TypeError: Argument 1 passed to think\model\Pivot::__construct() must be an instance of think\Model or null, array given
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 at src/model/relation/BelongsToMany.php line 105 and inspect the arguments passed when creating a think\model\Pivot instance. Compare them with the constructor signature and trace the many-to-many relation path that reaches this call. Done means the relation can create the Pivot object without the reported TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100