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

option to cascade delete operation for hasMany #56

Open
st-h opened this issue Aug 15, 2014 · 1 comment
Open

option to cascade delete operation for hasMany #56

st-h opened this issue Aug 15, 2014 · 1 comment

Comments

@st-h
Copy link
Contributor

st-h commented Aug 15, 2014

Is it possible to cascade the deletion of a parent entity to child entities? For instance for a config like this:

group.js:

export default EG.Model.extend({
  items: EG.hasMany({
      relatedType: 'item',
      inverse: 'group'
    })
});

item.js

export default EG.Model.extend({
  group: EG.hasOne({
    relatedType: 'group',
    inverse: 'items'
  }),
});

if a group record is deleted, all the items should be deleted as well. Probably this can be configured by a configurable cascade type to also handle case where this behaviour is not intended?
As for the communication to the server, only the delete operation for the group needs to be communicated, as the server cascades the delete operation to the children, which actually is a pretty common pattern.

@gordonkristan
Copy link
Contributor

I've thought about this before, and it does seem to be a common use case. I know I've certainly wanted it before. I just haven't gotten around to actually implementing it. I'll definitely put it on the list though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants