软删除,关联真实删除的时候,关联表无法真实删除
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start with the autoRelationDelete() entry point shown in the issue and trace how force deletion is propagated from order to its related goods. Check the model delete and soft-delete handling for related records. Done means that force-deleting the order also produces the expected permanent deletion behavior for the related goods and relation data.
Written by the indexing model from the issue text.
Description
$order->together(['goods'])->force(true)->delete();
order 真实删除
goods 软删除
/**
* 自动关联数据删除(支持一对一及一对多关联)
* @access protected
* @return void
*/
protected function autoRelationDelete(): void
{
foreach ($this->relationWrite as $key => $name) {
$name = is_numeric($key) ? $name : $key;
$result = $this->getRelation($name, true);
if ($result instanceof Model) {
$result->delete();
} elseif ($result instanceof Collection) {
foreach ($result as $model) {
$model->delete();
}
}
}
}
- Dominant language
- PHP
- Stars
- 437
- Forks
- 188
- PR merge metrics
- No merged PRs in 30d
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.
More from top-think/think-orm
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
在php7.3及以上版本中,会出错 Open
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
All issues in top-think/think-orm
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
getgrav/grav-plugin-api#45 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
RSS-Bridge/rss-bridge#5098 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
phingofficial/phing#2025 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
silverstripe/developer-docs#911 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100