top-think / top-think/think-orm

一对多关联删除的问题?

Open
#236 0 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

一对多关联,Order -> Goods

在调用$order->goods()->delete();时会提示delete without condition

问题出现在这里:https://github.com/top-think/think-orm/blob/123a095cd40ef044c7b3f7bcbf22e85082f264bd/src/model/Relation.php#L210

我想了解一下这个地方不“执行基础查询”,带入关联条件,是基于什么考虑呢?

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 with src/model/Relation.php around line 210 and reproduce the one-to-many call $order->goods()->delete() described in the issue. Trace how the relation condition and base query are handled, then determine why the delete triggers the “delete without condition” warning. Done means the behavior and its intended handling are documented or corrected with a verified reproduction.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.