Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simple delete for MANY_MANY #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

garex
Copy link

@garex garex commented Jan 7, 2014

I suggest to add just now simple delete logic to MANY_MANY relation. Not waiting for implementing of link/unlink.

Logic there is straight enough: remove in connection table all records, that related to owner. For example in case of saving article with tags we should just delete from article_tag all records, where article_id = 123. It will be enough for all cases, as later insert command adds all really needed records.

In the meantime we have tests written in AntonTyutin/yii-with-related-behavior@e00fc07 fork.

ps: I have read all related issues and comments

* We should always delete records even if all related are new
* Now $deleteAttributes fills up only once from ownerMap
  and then we build condition by owner attributes, ignoring related
hippostar pushed a commit to hippostar/with-related-behavior that referenced this pull request Feb 21, 2014
…es to models that are no longer referenced by owner model. Does not delete the actual models, only join table links.

- Implement unlink for MANY_TO_MANY relations.

- Re-uploading the same changes as the last commit but fixing the whitespace bug making it impossible to see actual changes.
- Changed the "delete" part of the code to only do *ONE* query. Copied from official pull request yiiext#32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant